Class: Mongo::Protocol::GetMore::Upconverter
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/mongo/protocol/get_more.rb |
Overview
Converts legacy getMore messages to the appropriare OP_COMMAND style message.
Constant Summary
-
GET_MORE =
Deprecated.
The get more constant.
'getMore'.freeze
Class Method Summary
-
.new(collection, cursor_id, number_to_return) ⇒ Upconverter
constructor
Instantiate the upconverter.
Instance Attribute Summary
- #collection ⇒ String readonly
- #cursor_id ⇒ Integer readonly
- #number_to_return ⇒ Integer readonly
Instance Method Summary
-
#command ⇒ BSON::Document
Get the upconverted command.
Constructor Details
.new(collection, cursor_id, number_to_return) ⇒ Upconverter
Instantiate the upconverter.
# File 'lib/mongo/protocol/get_more.rb', line 139
def initialize(collection, cursor_id, number_to_return) @collection = collection @cursor_id = cursor_id @number_to_return = number_to_return end
Instance Attribute Details
#collection ⇒ String
(readonly)
# File 'lib/mongo/protocol/get_more.rb', line 120
attr_reader :collection
#cursor_id ⇒ Integer
(readonly)
# File 'lib/mongo/protocol/get_more.rb', line 123
attr_reader :cursor_id
#number_to_return ⇒ Integer
(readonly)
# File 'lib/mongo/protocol/get_more.rb', line 126
attr_reader :number_to_return
Instance Method Details
#command ⇒ BSON::Document
Get the upconverted command.
# File 'lib/mongo/protocol/get_more.rb', line 153
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