class Moped::Protocol::GetMore

The Protocol class for retrieving more documents from a cursor.

@example Get more results using database default limit

insert = GetMore.new "moped", "people", 29301021, 0

@example Get more results using custom limit

insert = Insert.new "moped", "people", 29301021, 10

@example Setting the request id

insert = Insert.new "moped", "people", 29301021, 10,
  request_id: 123

Attributes

collection[R]

@return [String, Symbol] the collection this insert targets

database[R]

@return [String, Symbol] the database this insert targets

Public Class Methods

new(database, collection, cursor_id, limit, options = {}) click to toggle source

Create a new GetMore command. The database and collection arguments are joined together to set the full_collection_name.

@example

GetMore.new "moped", "users", 29301021, 10, request_id: 123
# File lib/moped/protocol/get_more.rb, line 65
def initialize(database, collection, cursor_id, limit, options = {})
  @database   = database
  @collection = collection

  @full_collection_name = "#{database}.#{collection}"
  @cursor_id            = cursor_id
  @limit                = limit
  @request_id           = options[:request_id]
end

Public Instance Methods

log_inspect() click to toggle source
# File lib/moped/protocol/get_more.rb, line 75
def log_inspect
  type = "GET_MORE"
  "%-12s database=%s collection=%s limit=%s cursor_id=%s" % [type, database, collection, limit, cursor_id]
end
op_code() click to toggle source

@return [Number] OP_GETMORE operation code (2005)

# File lib/moped/protocol/get_more.rb, line 50
def op_code
  2005
end
receive_replies(connection) click to toggle source

Receive replies to the message.

@example Receive replies.

message.receive_replies(connection)

@param [ Connection ] connection The connection.

@return [ Protocol::Reply ] The reply.

@since 1.0.0

# File lib/moped/protocol/get_more.rb, line 90
def receive_replies(connection)
  connection.read
end