Dart Documentationmongo_dartMongoGetMoreMessage

MongoGetMoreMessage class

class MongoGetMoreMessage extends MongoMessage{
 BsonCString _collectionFullName;
 int cursorId;
 int numberToReturn;
 MongoGetMoreMessage(String collectionFullName,
           this.cursorId,
           [this.numberToReturn = 20]
           ){
   _collectionFullName = new BsonCString(collectionFullName);
   opcode = MongoMessage.GetMore;
 }
 int get messageLength{
   return 16+4+_collectionFullName.byteLength()+4+8;
 }
 BsonBinary serialize(){
   BsonBinary buffer = new BsonBinary(messageLength);
   writeMessageHeaderTo(buffer);
   buffer.writeInt(0);
   _collectionFullName.packValue(buffer);
   buffer.writeInt(numberToReturn);
   buffer.writeInt64(cursorId);
   buffer.offset = 0;
   return buffer;
 }
 String toString(){
   return "MongoGetMoreMessage($requestId, ${_collectionFullName.value}, $cursorId)";
 }

}

Extends

MongoMessage > MongoGetMoreMessage

Constructors

new MongoGetMoreMessage(String collectionFullName, int cursorId, [int numberToReturn = 20]) #

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
MongoGetMoreMessage(String collectionFullName,
         this.cursorId,
         [this.numberToReturn = 20]
         ){
 _collectionFullName = new BsonCString(collectionFullName);
 opcode = MongoMessage.GetMore;
}

Properties

int cursorId #

int cursorId

final int messageLength #

int get messageLength{
 return 16+4+_collectionFullName.byteLength()+4+8;
}

int numberToReturn #

int numberToReturn

int opcode #

inherited from MongoMessage
int opcode = MongoMessage.Reply

final int requestId #

inherited from MongoMessage
int get requestId{
 if (_requestId == null){
   _requestId = _Statics.nextRequestId;
 }
 return _requestId;
}

int responseTo #

inherited from MongoMessage
int responseTo

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(numberToReturn);
 buffer.writeInt64(cursorId);
 buffer.offset = 0;
 return buffer;
}

String toString() #

Returns a string representation of this object.

docs inherited from Object
String toString(){
 return "MongoGetMoreMessage($requestId, ${_collectionFullName.value}, $cursorId)";
}

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');
   }
}