|
MongoDB C++ Driver
legacy-1.1.2
|
The interface that any db connection should implement. More...
#include <dbclientinterface.h>
Inheritance diagram for mongo::DBClientInterface:Public Member Functions | |
| virtual BSONObj | findOne (const std::string &ns, const Query &query, const BSONObj *fieldsToReturn=0, int queryOptions=0) |
| void | findN (std::vector< BSONObj > &out, const std::string &ns, Query query, int nToReturn, int nToSkip=0, const BSONObj *fieldsToReturn=0, int queryOptions=0, int batchSize=0) |
| query N objects from the database into an array. More... | |
| void | save (const StringData &ns, const BSONObj &toSave, const WriteConcern *wc=NULL) |
| Saves a document to a collection. More... | |
| virtual std::auto_ptr< DBClientCursor > | getMore (const std::string &ns, long long cursorId, int nToReturn=0, int options=0)=0 |
| don't use this - called automatically by DBClientCursor for you | |
The interface that any db connection should implement.
| void mongo::DBClientInterface::findN | ( | std::vector< BSONObj > & | out, |
| const std::string & | ns, | ||
| Query | query, | ||
| int | nToReturn, | ||
| int | nToSkip = 0, |
||
| const BSONObj * | fieldsToReturn = 0, |
||
| int | queryOptions = 0, |
||
| int | batchSize = 0 |
||
| ) |
query N objects from the database into an array.
makes sense mostly when you want a small number of results. if a huge number, use query() and iterate the cursor.
|
virtual |
| AssertionException |
Reimplemented in mongo::DBClientReplicaSet.
| void mongo::DBClientInterface::save | ( | const StringData & | ns, |
| const BSONObj & | toSave, | ||
| const WriteConcern * | wc = NULL |
||
| ) |
Saves a document to a collection.
If 'toSave' already has an '_id' then an update(upsert) operation is performed and any existing document with that '_id' is overwritten. Otherwise, an insert operation is performed.
| ns | The namespace to save the document into. |
| toSave | The document to save. |
| wc | The write concern for this operation. |
1.8.10