Queries return a cursor object. More...
#include <dbclientcursor.h>
Public Member Functions | |
| bool | more () |
| If true, safe to call next(). | |
| int | objsLeftInBatch () const |
| If true, there is more in our local buffers to be fetched via next(). | |
| bool | moreInCurrentBatch () |
| BSONObj | next () |
| next | |
| void | putBack (const BSONObj &o) |
| restore an object previously returned by next() to the cursor | |
| BSONObj | nextSafe () |
| throws AssertionException if get back { $err : . | |
| void | peek (vector< BSONObj > &, int atMost) |
| peek ahead at items buffered for future next() calls. | |
| BSONObj | peekOne () |
| int | itcount () |
| iterate the rest of the cursor and return the number if items | |
| bool | isDead () const |
| cursor no longer valid -- use with tailable cursors. | |
| bool | tailable () const |
| bool | hasResultFlag (int flag) |
| see ResultFlagType (constants.h) for flag values mostly these flags are for internal purposes - ResultFlag_ErrSet is the possible exception to that | |
| DBClientCursor (DBClientBase *client, const string &_ns, BSONObj _query, int _nToReturn, int _nToSkip, const BSONObj *_fieldsToReturn, int queryOptions, int bs) | |
| DBClientCursor (DBClientBase *client, const string &_ns, long long _cursorId, int _nToReturn, int options) | |
| long long | getCursorId () const |
| void | decouple () |
| by default we "own" the cursor and will send the server a KillCursor message when ~DBClientCursor() is called. | |
| void | attach (AScopedConnection *conn) |
Friends | |
| class | DBClientBase |
| class | DBClientConnection |
Queries return a cursor object.
| void mongo::DBClientCursor::decouple | ( | ) | [inline] |
by default we "own" the cursor and will send the server a KillCursor message when ~DBClientCursor() is called.
This function overrides that.
| bool mongo::DBClientCursor::isDead | ( | ) | const [inline] |
cursor no longer valid -- use with tailable cursors.
note you should only rely on this once more() returns false; 'dead' may be preset yet some data still queued and locally available from the dbclientcursor.
| bool mongo::DBClientCursor::more | ( | ) | [virtual] |
If true, safe to call next().
Requests more from server if necessary.
Implements mongo::DBClientCursorInterface.
| BSONObj mongo::DBClientCursor::next | ( | ) | [virtual] |
next
Implements mongo::DBClientCursorInterface.
| BSONObj mongo::DBClientCursor::nextSafe | ( | ) | [inline] |
throws AssertionException if get back { $err : .
.. }
| int mongo::DBClientCursor::objsLeftInBatch | ( | ) | const [inline] |
If true, there is more in our local buffers to be fetched via next().
Returns false when a getMore request back to server would be required. You can use this if you want to exhaust whatever data has been fetched to the client already but then perhaps stop.
| void mongo::DBClientCursor::peek | ( | vector< BSONObj > & | v, | |
| int | atMost | |||
| ) |
peek ahead at items buffered for future next() calls.
never requests new data from the server. so peek only effective with what is already buffered. WARNING: no support for _putBack yet!
1.6.3