public class Delete extends AbstractMessage
struct {
MsgHeader header; // standard message header
int32 ZERO; // 0 - reserved for future use
cstring fullCollectionName; // "dbname.collectionname"
int32 flags; // bit vector - see below for details.
document selector; // query object. See below for details.
}
| Modifier and Type | Field and Description |
|---|---|
static int |
SINGLE_DELETE_BIT
The flag bit for performing a single delete only.
|
HEADER_SIZE, myCollectionName, myDatabaseName| Constructor and Description |
|---|
Delete(BsonInputStream in)
Create a new Delete message.
|
Delete(String databaseName,
String collectionName,
Document query,
boolean singleDelete)
Create a new Delete message.
|
| 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.
|
String |
getOperationName()
Returns a short name for the operation.
|
Document |
getQuery()
Returns the query
Document. |
int |
hashCode()
Computes a reasonable hash code.
|
boolean |
isSingleDelete()
Returns if only a single or all matching documents should be deleted.
|
int |
size()
Returns the total size of the message on the wire.
|
void |
validateSize(SizeOfVisitor visitor,
int maxDocumentSize)
Validates that the documents with the message do not exceed the maximum
document size specified.
|
void |
write(int messageId,
BsonOutputStream out)
Writes the message from the stream.
|
void |
write(int messageId,
BufferingBsonOutputStream out)
Writes the message from the stream.
|
finishHeader, getCollectionName, getDatabaseName, getReadPreference, getRequiredVersionRange, init, writeHeader, writeHeaderpublic static final int SINGLE_DELETE_BIT
public Delete(BsonInputStream in) throws IOException
in - The stream to read the delete message from.IOException - On a failure reading the delete message.public Delete(String databaseName, String collectionName, Document query, boolean singleDelete)
databaseName - The name of the database.collectionName - The name of the collection.query - The query document for selecting documents to delete.singleDelete - If true, only the first document found should be deleted,
otherwise all matching documents should be deleted.public boolean equals(Object object)
equals in class AbstractMessageobject - The object to compare to.Object.equals(java.lang.Object)public String getOperationName()
Overridden to return the name of the operation: "DELETE".
public int hashCode()
hashCode in class AbstractMessagepublic boolean isSingleDelete()
public int size()
Overridden to return the size of the Delete.
public void validateSize(SizeOfVisitor visitor, int maxDocumentSize) throws DocumentToLargeException
Overridden to ensure the query document is not too large.
visitor - The SizeOfVisitor to compute the size of the document.maxDocumentSize - The maximum document size to validate against.DocumentToLargeException - If one of the documents in the message is too large or the
documents in aggregate are too large.public void write(int messageId,
BsonOutputStream out)
throws IOException
Overridden to write a delete 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, com.allanbank.mongodb.bson.io.BsonOutputStream)public void write(int messageId,
BufferingBsonOutputStream out)
throws IOException
Overridden to write a delete 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, com.allanbank.mongodb.bson.io.BsonOutputStream)Copyright © 2011–2014 Allanbank Consulting, Inc.. All rights reserved.