Class: Mongo::Protocol::GetMore::Upconverter
- Inherits:
-
Object
- Object
- Mongo::Protocol::GetMore::Upconverter
- Defined in:
- lib/mongo/protocol/get_more.rb
Overview
Converts legacy getMore messages to the appropriate OP_COMMAND style message.
Constant Summary collapse
- GET_MORE =
Deprecated.
The get more constant.
'getMore'
Instance Attribute Summary collapse
-
#collection ⇒ String
readonly
Collection The name of the collection.
-
#cursor_id ⇒ Integer
readonly
Cursor_id The cursor id.
-
#number_to_return ⇒ Integer
readonly
Number_to_return The number of docs to return.
Instance Method Summary collapse
-
#command ⇒ BSON::Document
Get the upconverted command.
-
#initialize(collection, cursor_id, number_to_return) ⇒ Upconverter
constructor
Instantiate the upconverter.
Constructor Details
#initialize(collection, cursor_id, number_to_return) ⇒ Upconverter
Instantiate the upconverter.
133 134 135 136 137 |
# File 'lib/mongo/protocol/get_more.rb', line 133 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)
Returns collection The name of the collection.
114 115 116 |
# File 'lib/mongo/protocol/get_more.rb', line 114 def collection @collection end |
#cursor_id ⇒ Integer (readonly)
Returns cursor_id The cursor id.
117 118 119 |
# File 'lib/mongo/protocol/get_more.rb', line 117 def cursor_id @cursor_id end |
#number_to_return ⇒ Integer (readonly)
Returns number_to_return The number of docs to return.
120 121 122 |
# File 'lib/mongo/protocol/get_more.rb', line 120 def number_to_return @number_to_return end |
Instance Method Details
#command ⇒ BSON::Document
Get the upconverted command.
147 148 149 150 151 152 153 |
# File 'lib/mongo/protocol/get_more.rb', line 147 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 |