INSERT packet

The INSERT packet is sent by the client to insert one or more document in a collection. Note that more recent applications tend to use an MSG packet instead. For more details, consult the MongoDB documentation.


Methods

int getInsertFlags()
Returns the flags -- there is only one that is valid: 0x0001, meaning continue on error. See the MongoDB documentation for details.

void setInsertFlags(int flags)
Sets the flags. Can only accept 0 or 1.

String getFullCollectionName()
Returns the full name of the collection into which the document(s) should be inserted.

void setFullCollectionName(String name)
Sets the full name of the collection into which the document(s) should be inserted.

List<BSONObject> getDocuments()
Returns one or more BSON documents as BSONObjects to be inserted. These documents can be modified.

BSONObject getDocument(int index)
Returns the document at the specified index.

object getDocumentJson(int index)
Returns the document at the specified index, in a JavaScript-friendly format, which is easier to navigate and modify than BSONObject instances.