mongo::DBClientCursor Class Reference

#include <dbclientcursor.h>

Inheritance diagram for mongo::DBClientCursor:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void attach (AScopedConnection *conn)
 DBClientCursor (DBClientBase *client, const string &_ns, long long _cursorId, int _nToReturn, int options)
 DBClientCursor (DBClientBase *client, const string &_ns, BSONObj _query, int _nToReturn, int _nToSkip, const BSONObj *_fieldsToReturn, int queryOptions, int bs)
void decouple ()
long long getCursorId () const
bool hasResultFlag (int flag)
bool isDead () const
int itcount ()
bool more ()
bool moreInCurrentBatch ()
BSONObj next ()
BSONObj nextSafe ()
int objsLeftInBatch () const
void peek (vector< BSONObj > &, int atMost)
void putBack (const BSONObj &o)
bool tailable () const
virtual ~DBClientCursor ()

Private Member Functions

void _assertIfNull () const
void dataReceived ()
 DBClientCursor (const DBClientCursor &)
void exhaustReceiveMore ()
bool init ()
int nextBatchSize ()
DBClientCursoroperator= (const DBClientCursor &)
void requestMore ()

Private Attributes

DBClientBase_client
bool _ownCursor
stack< BSONObj_putBack
string _scopedHost
int batchSize
long long cursorId
const char * data
const BSONObjfieldsToReturn
bool haveLimit
auto_ptr< Messagem
int nReturned
string ns
int nToReturn
int nToSkip
int opts
int pos
BSONObj query
int resultFlags

Friends

class DBClientBase
class DBClientConnection

Detailed Description

Queries return a cursor object

Definition at line 45 of file dbclientcursor.h.


Constructor & Destructor Documentation

mongo::DBClientCursor::DBClientCursor ( DBClientBase client,
const string &  _ns,
BSONObj  _query,
int  _nToReturn,
int  _nToSkip,
const BSONObj _fieldsToReturn,
int  queryOptions,
int  bs 
) [inline]

Definition at line 124 of file dbclientcursor.h.

mongo::DBClientCursor::DBClientCursor ( DBClientBase client,
const string &  _ns,
long long  _cursorId,
int  _nToReturn,
int  options 
) [inline]

Definition at line 143 of file dbclientcursor.h.

virtual mongo::DBClientCursor::~DBClientCursor (  )  [virtual]
mongo::DBClientCursor::DBClientCursor ( const DBClientCursor  )  [private]

Member Function Documentation

void mongo::DBClientCursor::_assertIfNull (  )  const [inline, private]

Definition at line 196 of file dbclientcursor.h.

void mongo::DBClientCursor::attach ( AScopedConnection conn  ) 
void mongo::DBClientCursor::dataReceived (  )  [private]
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.

Definition at line 164 of file dbclientcursor.h.

void mongo::DBClientCursor::exhaustReceiveMore (  )  [private]
long long mongo::DBClientCursor::getCursorId (  )  const [inline]

Definition at line 159 of file dbclientcursor.h.

bool mongo::DBClientCursor::hasResultFlag ( int  flag  )  [inline]

see ResultFlagType (constants.h) for flag values mostly these flags are for internal purposes - ResultFlag_ErrSet is the possible exception to that

Definition at line 119 of file dbclientcursor.h.

bool mongo::DBClientCursor::init (  )  [private]
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.

Definition at line 107 of file dbclientcursor.h.

int mongo::DBClientCursor::itcount (  )  [inline]

iterate the rest of the cursor and return the number if items

Definition at line 93 of file dbclientcursor.h.

bool mongo::DBClientCursor::more (  )  [virtual]

If true, safe to call next(). Requests more from server if necessary.

Implements mongo::DBClientCursorInterface.

bool mongo::DBClientCursor::moreInCurrentBatch (  )  [inline]

Definition at line 56 of file dbclientcursor.h.

BSONObj mongo::DBClientCursor::next (  )  [virtual]

next

Returns:
next object in the result cursor. on an error at the remote server, you will get back: { $err: <string> } if you do not want to handle that yourself, call nextSafe().

Implements mongo::DBClientCursorInterface.

int mongo::DBClientCursor::nextBatchSize (  )  [private]
BSONObj mongo::DBClientCursor::nextSafe (  )  [inline]

throws AssertionException if get back { $err : ... }

Definition at line 72 of file dbclientcursor.h.

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.

Definition at line 55 of file dbclientcursor.h.

DBClientCursor& mongo::DBClientCursor::operator= ( const DBClientCursor  )  [private]
void mongo::DBClientCursor::peek ( vector< BSONObj > &  ,
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!

void mongo::DBClientCursor::putBack ( const BSONObj o  )  [inline]

restore an object previously returned by next() to the cursor

Definition at line 69 of file dbclientcursor.h.

void mongo::DBClientCursor::requestMore (  )  [private]
bool mongo::DBClientCursor::tailable (  )  const [inline]

Definition at line 111 of file dbclientcursor.h.


Friends And Related Function Documentation

friend class DBClientBase [friend]

Definition at line 169 of file dbclientcursor.h.

friend class DBClientConnection [friend]

Definition at line 170 of file dbclientcursor.h.


Member Data Documentation

Definition at line 173 of file dbclientcursor.h.

Definition at line 192 of file dbclientcursor.h.

Definition at line 183 of file dbclientcursor.h.

Definition at line 193 of file dbclientcursor.h.

Definition at line 181 of file dbclientcursor.h.

long long mongo::DBClientCursor::cursorId [private]

Definition at line 185 of file dbclientcursor.h.

const char* mongo::DBClientCursor::data [private]

Definition at line 188 of file dbclientcursor.h.

Definition at line 179 of file dbclientcursor.h.

Definition at line 177 of file dbclientcursor.h.

auto_ptr<Message> mongo::DBClientCursor::m [private]

Definition at line 182 of file dbclientcursor.h.

Definition at line 186 of file dbclientcursor.h.

string mongo::DBClientCursor::ns [private]

Definition at line 174 of file dbclientcursor.h.

Definition at line 176 of file dbclientcursor.h.

Definition at line 178 of file dbclientcursor.h.

Definition at line 180 of file dbclientcursor.h.

Definition at line 187 of file dbclientcursor.h.

Definition at line 175 of file dbclientcursor.h.

Definition at line 184 of file dbclientcursor.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


mongodb
Author(s): Nate Koenig
autogenerated on Fri Jan 11 12:15:54 2013