REPLY packet

The REPLY packet is the only type of packet that can only be sent by a server -- it can never be sent by a client. For details, see the MongoDB documentation.


Methods

int getResponseFlags()
Returns the response flags. See the MongoDB documentation for the meaning of these flags.

void setResponseFlags(int responseFlags)
Sets the response flags.

long getCursorID()
Gets the cursor ID, unless the response fits in one REPLY packet, in which case this will be 0.

void setCursorID(int id)
Sets the cursor ID -- it would be unusual for user logic to change it, but it is possible.

int getStartingFrom()
Gets the starting position in the cursor.

void setStartingFrom(int from)
Sets the starting position in the cursor.

int getNumberReturned()
Gets the number of documents in the reply. This number cannot be directly changed -- it is computed from the number of documents.

List<object> getDocuments()
Gets the documents in the reply.

object getDocument(int index)
Gets the specified document in a JavaScript-friendly format. The returned document can be modified.

object removeDocument(int idx)
Removes the specified document.

object replaceDocument(int idx, object doc)
Replaces the document at the specified index.