Upconverter — Documentation by YARD 0.9.37 (original) (raw)

Class: Mongo::Protocol::GetMore::Upconverter

Inherits:

Object

Defined in:

lib/mongo/protocol/get_more.rb

Overview

Converts legacy getMore messages to the appropriare OP_COMMAND style message.

Constant Summarycollapse

GET_MORE =

'getMore'.freeze

Instance Attribute Summary collapse

Instance Method Summarycollapse

Constructor Details

#initialize(collection, cursor_id, number_to_return) ⇒ Upconverter

Instantiate the upconverter.

139 140 141 142 143 # 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

Returns collection The name of the collection.

120 121 122 # File 'lib/mongo/protocol/get_more.rb', line 120 def collection @collection end

#cursor_id ⇒ Integer

Returns cursor_id The cursor id.

123 124 125 # File 'lib/mongo/protocol/get_more.rb', line 123 def cursor_id @cursor_id end

#number_to_return ⇒ Integer

Returns number_to_return The number of docs to return.

126 127 128 # File 'lib/mongo/protocol/get_more.rb', line 126 def number_to_return @number_to_return end

Instance Method Details

#command ⇒ BSON::Document

Get the upconverted command.

153 154 155 156 157 158 159 # 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