Poco::MongoDB

class OpMsgCursor

Library: MongoDB
Package: MongoDB
Header: Poco/MongoDB/OpMsgCursor.h

Description

OpMsgCursor is an helper class for querying multiple documents using OpMsgMessage.

Inheritance

Direct Base Classes: Document

All Base Classes: Document

Member Summary

Member Functions: batchSize, cursorID, emptyFirstBatch, kill, next, query, setBatchSize, setEmptyFirstBatch

Inherited Functions: add, addElement, addNewArray, addNewDocument, clear, elementNames, empty, exists, get, getInteger, isType, read, remove, size, toString, write

Constructors

OpMsgCursor

OpMsgCursor(
    const std::string & dbname,
    const std::string & collectionName
);

Creates a OpMsgCursor for the given database and collection.

Destructor

~OpMsgCursor virtual

virtual ~OpMsgCursor();

Destroys the OpMsgCursor.

Member Functions

batchSize

Int32 batchSize() const;

Current batch size (zero or negative number indicates default batch size)

cursorID inline

Int64 cursorID() const;

emptyFirstBatch

bool emptyFirstBatch() const;

kill

void kill(
    Connection & connection
);

Kills the cursor and reset it so that it can be reused.

next

OpMsgMessage & next(
    Connection & connection
);

Tries to get the next documents. As long as response message has a cursor ID next can be called to retrieve the next bunch of documents.

The cursor must be killed (see kill()) when not all documents are needed.

query inline

OpMsgMessage & query();

Returns the associated query.

setBatchSize

void setBatchSize(
    Int32 batchSize
);

Set non-default batch size

setEmptyFirstBatch

void setEmptyFirstBatch(
    bool empty
);

Empty first batch is used to get error response faster with little server processing