MongoDB C++ Driver legacy-1.0.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
mongo::DBClientInterface Class Referenceabstract

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.
 
void save (const StringData &ns, const BSONObj &toSave, const WriteConcern *wc=NULL)
 Saves a document to a collection.
 
virtual std::auto_ptr< DBClientCursorgetMore (const std::string &ns, long long cursorId, int nToReturn=0, int options=0)=0
 don't use this - called automatically by DBClientCursor for you
 

Detailed Description

The interface that any db connection should implement.

Member Function Documentation

◆ findN()

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.

◆ findOne()

virtual BSONObj mongo::DBClientInterface::findOne ( const std::string &  ns,
const Query query,
const BSONObj fieldsToReturn = 0,
int  queryOptions = 0 
)
virtual
Returns
a single object that matches the query. if none do, then the object is empty
Exceptions
AssertionException

Reimplemented in mongo::DBClientReplicaSet.

◆ save()

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.

Parameters
nsThe namespace to save the document into.
toSaveThe document to save.
wcThe write concern for this operation.

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