public class Insert extends AbstractMessage
struct {
MsgHeader header; // standard message header
int32 flags; // bit vector - see below
cstring fullCollectionName; // "dbname.collectionname"
document* documents; // one or more documents to insert into the collection
}
| Modifier and Type | Field and Description |
|---|---|
static int |
CONTINUE_ON_ERROR_BIT
The flag bit to keep inserting documents on an error.
|
HEADER_SIZE, myCollectionName, myDatabaseName| Constructor and Description |
|---|
Insert(Header header,
BsonInputStream in)
Creates a new Insert.
|
Insert(String databaseName,
String collectionName,
List<Document> documents,
boolean continueOnError)
Creates a new Insert.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object object)
Determines if the passed object is of this same type as this object and
if so that its fields are equal.
|
List<Document> |
getDocuments()
Returns the documents to insert.
|
int |
hashCode()
Computes a reasonable hash code.
|
boolean |
isContinueOnError()
Returns true if the insert should continue with other documents if one of
the document inserts encounters an error.
|
void |
write(int messageId,
BsonOutputStream out)
Writes the message from the stream.
|
getCollectionName, getDatabaseName, getReadPreference, init, writeHeaderpublic static final int CONTINUE_ON_ERROR_BIT
public Insert(Header header, BsonInputStream in) throws IOException
header - The header proceeding the insert message. This is used to
locate the end of the insert.in - The stream to read the insert message from.IOException - On a failure reading the insert message.public Insert(String databaseName, String collectionName, List<Document> documents, boolean continueOnError)
databaseName - The name of the database.collectionName - The name of the collection.documents - The documents to be inserted.continueOnError - If the insert should continue if one of the documents causes
an error.public boolean equals(Object object)
equals in class AbstractMessageobject - The object to compare to.Object.equals(java.lang.Object)public List<Document> getDocuments()
public int hashCode()
hashCode in class AbstractMessagepublic boolean isContinueOnError()
public void write(int messageId,
BsonOutputStream out)
throws IOException
Overridden to write the insert message.
messageId - The id to be assigned to the message.out - The sink for data written.IOException - On an error writing to the stream.Message.write(int, BsonOutputStream)Copyright © 2011-2012 Allanbank Consulting, Inc.. All Rights Reserved.