Class: Mongo::Protocol::KillCursors::Upconverter
- Inherits:
-
Object
- Object
- Mongo::Protocol::KillCursors::Upconverter
- Defined in:
- lib/mongo/protocol/kill_cursors.rb
Overview
Converts legacy insert messages to the appropriare OP_COMMAND style message.
Instance Attribute Summary collapse
-
#collection ⇒ String
readonly
Collection The name of the collection.
-
#cursor_ids ⇒ Array<Integer>
readonly
Cursor_ids The cursor ids.
Instance Method Summary collapse
-
#command ⇒ BSON::Document
Get the upconverted command.
-
#initialize(collection, cursor_ids) ⇒ Upconverter
constructor
Instantiate the upconverter.
Constructor Details
#initialize(collection, cursor_ids) ⇒ Upconverter
Instantiate the upconverter.
106 107 108 109 |
# 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)
Returns collection The name of the collection.
92 93 94 |
# File 'lib/mongo/protocol/kill_cursors.rb', line 92 def collection @collection end |
#cursor_ids ⇒ Array<Integer> (readonly)
Returns cursor_ids The cursor ids.
95 96 97 |
# File 'lib/mongo/protocol/kill_cursors.rb', line 95 def cursor_ids @cursor_ids end |
Instance Method Details
#command ⇒ BSON::Document
Get the upconverted command.
119 120 121 122 123 124 125 126 127 |
# 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 |