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 appropriate 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.
100 101 102 103 |
# File 'lib/mongo/protocol/kill_cursors.rb', line 100 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.
86 87 88 |
# File 'lib/mongo/protocol/kill_cursors.rb', line 86 def collection @collection end |
#cursor_ids ⇒ Array<Integer> (readonly)
Returns cursor_ids The cursor ids.
89 90 91 |
# File 'lib/mongo/protocol/kill_cursors.rb', line 89 def cursor_ids @cursor_ids end |
Instance Method Details
#command ⇒ BSON::Document
Get the upconverted command.
113 114 115 116 117 118 119 120 121 |
# File 'lib/mongo/protocol/kill_cursors.rb', line 113 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 |