class Mongo::Protocol::GetMore::Upconverter
Converts legacy getMore messages to the appropriare OP_COMMAND style message.
@since 2.1.0
Constants
- GET_MORE
The get more constant.
@since 2.2.0 @deprecated
Attributes
collection[R]
@return [ String ] collection The name of the collection.
cursor_id[R]
@return [ Integer ] cursor_id
The cursor id.
number_to_return[R]
@return [ Integer ] number_to_return
The number of docs to return.
Public Class Methods
new(collection, cursor_id, number_to_return)
click to toggle source
Instantiate the upconverter.
@example Instantiate the upconverter.
Upconverter.new('users', 1, 1)
@param [ String ] collection The name of the collection. @param [ Integer ] cursor_id
The cursor id. @param [ Integer ] number_to_return
The number of documents to
return.
@since 2.1.0
# File lib/mongo/protocol/get_more.rb, line 136 def initialize(collection, cursor_id, number_to_return) @collection = collection @cursor_id = cursor_id @number_to_return = number_to_return end
Public Instance Methods
command()
click to toggle source
Get the upconverted command.
@example Get the command.
upconverter.command
@return [ BSON::Document ] The upconverted command.
@since 2.1.0
# File lib/mongo/protocol/get_more.rb, line 150 def command document = BSON::Document.new document.store('getMore', BSON::Int64.new(cursor_id)) document.store(Message::BATCH_SIZE, number_to_return) document.store(Message::COLLECTION, collection) document end