Class: Mongo::Protocol::KillCursors::Upconverter
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/mongo/protocol/kill_cursors.rb |
Overview
Converts legacy insert messages to the appropriare OP_COMMAND style message.
Class Method Summary
-
.new(collection, cursor_ids) ⇒ Upconverter
constructor
Instantiate the upconverter.
Instance Attribute Summary
- #collection ⇒ String readonly
- #cursor_ids ⇒ Array<Integer> readonly
Instance Method Summary
-
#command ⇒ BSON::Document
Get the upconverted command.
Constructor Details
.new(collection, cursor_ids) ⇒ Upconverter
Instantiate the upconverter.
# File 'lib/mongo/protocol/kill_cursors.rb', line 106
def initialize(collection, cursor_ids) @collection = collection @cursor_ids = cursor_ids end
Instance Attribute Details
#collection ⇒ String
(readonly)
# File 'lib/mongo/protocol/kill_cursors.rb', line 92
attr_reader :collection
#cursor_ids ⇒ Array
<Integer
> (readonly)
# File 'lib/mongo/protocol/kill_cursors.rb', line 95
attr_reader :cursor_ids
Instance Method Details
#command ⇒ BSON::Document
Get the upconverted command.
# File 'lib/mongo/protocol/kill_cursors.rb', line 119
def command document = BSON::Document.new document.store('killCursors', collection) store_ids = cursor_ids.map do |cursor_id| BSON::Int64.new(cursor_id) end document.store('cursors', store_ids) document end