|
MongoDB
2.1.1-pre-
|
The interface that any db connection should implement. More...
#include <dbclient.h>
Public Member Functions | |
| virtual auto_ptr< DBClientCursor > | query (const string &ns, Query query, int nToReturn=0, int nToSkip=0, const BSONObj *fieldsToReturn=0, int queryOptions=0, int batchSize=0)=0 |
| virtual void | insert (const string &ns, BSONObj obj, int flags=0)=0 |
| virtual void | insert (const string &ns, const vector< BSONObj > &v, int flags=0)=0 |
| virtual void | remove (const string &ns, Query query, bool justOne=0)=0 |
| virtual void | update (const string &ns, Query query, BSONObj obj, bool upsert=0, bool multi=0)=0 |
| virtual BSONObj | findOne (const string &ns, const Query &query, const BSONObj *fieldsToReturn=0, int queryOptions=0) |
| void | findN (vector< BSONObj > &out, const string &ns, Query query, int nToReturn, int nToSkip=0, const BSONObj *fieldsToReturn=0, int queryOptions=0) |
| query N objects from the database into an array. | |
| virtual string | getServerAddress () const =0 |
| virtual auto_ptr< DBClientCursor > | getMore (const 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 | ( | vector< BSONObj > & | out, |
| const string & | ns, | ||
| Query | query, | ||
| int | nToReturn, | ||
| int | nToSkip = 0, |
||
| const BSONObj * | fieldsToReturn = 0, |
||
| int | queryOptions = 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.
| BSONObj mongo::DBClientInterface::findOne | ( | const string & | ns, |
| const Query & | query, | ||
| const BSONObj * | fieldsToReturn = 0, |
||
| int | queryOptions = 0 |
||
| ) | [virtual] |
| AssertionException |
Reimplemented in mongo::DBClientReplicaSet, and mongo::SyncClusterConnection.
1.8.0