MongoDB  2.0.3
Public Member Functions | Protected Attributes
mongo::Model Class Reference

Model is a base class for defining objects which are serializable to the Mongo database via the database driver. More...

#include <model.h>

List of all members.

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

Detailed Description

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.


Member Function Documentation

bool mongo::Model::load ( BSONObj query) [virtual]

Load a single object.

Returns:
true if successful.

The documentation for this class was generated from the following files: