class Mongo::Protocol::GetMore

MongoDB Wire protocol getMore message.

This is a client request message that is sent to the server in order to retrieve additional documents from a cursor that has already been instantiated.

The operation requires that you specify the database and collection name as well as the cursor id because cursors are scoped to a namespace.

@api semipublic

Constants

OP_CODE

The operation code required to specify a getMore message. @return [Fixnum] the operation code.

@since 2.5.0

Attributes

upconverter[R]

Public Class Methods

new(database, collection, number_to_return, cursor_id) click to toggle source

Creates a new getMore message

@example Get 15 additional documents from cursor 123 in 'xgen.users'.

GetMore.new('xgen', 'users', 15, 123)

@param database [String, Symbol] The database to query. @param collection [String, Symbol] The collection to query. @param number_to_return [Integer] The number of documents to return. @param cursor_id [Integer] The cursor id returned in a reply.

Calls superclass method
# File lib/mongo/protocol/get_more.rb, line 39
def initialize(database, collection, number_to_return, cursor_id)
  @database = database
  @namespace = "#{database}.#{collection}"
  @number_to_return = number_to_return
  @cursor_id = cursor_id
  @upconverter = Upconverter.new(collection, cursor_id, number_to_return)
  super
end

Public Instance Methods

payload() click to toggle source

Return the event payload for monitoring.

@example Return the event payload.

message.payload

@return [ BSON::Document ] The event payload.

@since 2.1.0

# File lib/mongo/protocol/get_more.rb, line 56
def payload
  BSON::Document.new(
    command_name: 'getMore',
    database_name: @database,
    command: upconverter.command,
    request_id: request_id
  )
end
replyable?() click to toggle source

Get more messages require replies from the database.

@example Does the message require a reply?

message.replyable?

@return [ true ] Always true for get more.

@since 2.0.0

# File lib/mongo/protocol/get_more.rb, line 73
def replyable?
  true
end