MongoRemoveMessage class
class MongoRemoveMessage extends MongoMessage{ BsonCString _collectionFullName; int flags; BsonMap _selector; MongoRemoveMessage(String collectionFullName, [Map selector = const {}, this.flags = 0] ){ _collectionFullName = new BsonCString(collectionFullName); _selector = new BsonMap(selector); opcode = MongoMessage.Delete; } int get messageLength{ return 16+4+_collectionFullName.byteLength()+4+_selector.byteLength(); } BsonBinary serialize(){ BsonBinary buffer = new BsonBinary(messageLength); writeMessageHeaderTo(buffer); buffer.writeInt(0); _collectionFullName.packValue(buffer); buffer.writeInt(flags); _selector.packValue(buffer); buffer.offset = 0; return buffer; } String toString(){ return "MongoRemoveMessage($requestId, ${_collectionFullName.value}, ${_selector.value})"; } }
Extends
MongoMessage > MongoRemoveMessage
Constructors
new MongoRemoveMessage(String collectionFullName, [Map selector = const{}, int flags = 0]) #
Creates a new Object instance.
Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.
docs inherited from Object
MongoRemoveMessage(String collectionFullName, [Map selector = const {}, this.flags = 0] ){ _collectionFullName = new BsonCString(collectionFullName); _selector = new BsonMap(selector); opcode = MongoMessage.Delete; }
Properties
final int messageLength #
int get messageLength{ return 16+4+_collectionFullName.byteLength()+4+_selector.byteLength(); }
final int requestId #
inherited from MongoMessage
int get requestId{ if (_requestId == null){ _requestId = _Statics.nextRequestId; } return _requestId; }
Methods
MongoMessage deserialize(BsonBinary buffer) #
inherited from MongoMessage
MongoMessage deserialize(BsonBinary buffer){ throw new MongoDartError('Must be implemented'); }
dynamic readMessageHeaderFrom(BsonBinary buffer) #
inherited from MongoMessage
readMessageHeaderFrom(BsonBinary buffer) { _messageLength = buffer.readInt32(); _requestId = buffer.readInt32(); responseTo = buffer.readInt32(); int opcodeFromWire = buffer.readInt32(); if (opcodeFromWire != opcode) { throw new MongoDartError('Expected $opcode in Message header. Got $opcodeFromWire'); } }
BsonBinary serialize() #
BsonBinary serialize(){ BsonBinary buffer = new BsonBinary(messageLength); writeMessageHeaderTo(buffer); buffer.writeInt(0); _collectionFullName.packValue(buffer); buffer.writeInt(flags); _selector.packValue(buffer); buffer.offset = 0; return buffer; }
String toString() #
Returns a string representation of this object.
docs inherited from Object
String toString(){ return "MongoRemoveMessage($requestId, ${_collectionFullName.value}, ${_selector.value})"; }
dynamic writeMessageHeaderTo(BsonBinary buffer) #
inherited from MongoMessage
writeMessageHeaderTo(BsonBinary buffer) { buffer.writeInt(messageLength); // messageLength will be backpatched later buffer.writeInt(requestId); buffer.writeInt(0); // responseTo not used in requests sent by client buffer.writeInt(opcode); if (messageLength < 0){ throw new MongoDartError('Error in message length'); } }