|
MongoDB
2.0.3
|
Model is a base class for defining objects which are serializable to the Mongo database via the database driver. More...
#include <model.h>
Public Member Functions | |
| virtual const char * | getNS ()=0 |
| virtual void | serialize (BSONObjBuilder &to)=0 |
| virtual void | unserialize (const BSONObj &from)=0 |
| virtual BSONObj | toObject () |
| virtual void | append (const char *name, BSONObjBuilder &b) |
| virtual string | modelServer ()=0 |
| virtual bool | load (BSONObj &query) |
| Load a single object. | |
| virtual void | save (bool safe=false) |
| virtual void | remove (bool safe=false) |
Protected Attributes | |
| BSONObj | _id |
Model is a base class for defining objects which are serializable to the Mongo database via the database driver.
Definition Your serializable class should inherit from Model and implement the abstract methods below.
Loading To load, first construct an (empty) object. Then call load(). Do not load an object more than once.
| bool mongo::Model::load | ( | BSONObj & | query | ) | [virtual] |
Load a single object.
1.8.0