Class: Mongo::Protocol::Delete::Upconverter
- Inherits:
-
Object
- Object
- Mongo::Protocol::Delete::Upconverter
- Defined in:
- lib/mongo/protocol/delete.rb
Overview
Converts legacy delete messages to the appropriare OP_COMMAND style message.
Constant Summary collapse
- DELETE =
The delete command constant.
'delete'.freeze
- DELETES =
The deletes command constant.
'deletes'.freeze
Instance Attribute Summary collapse
-
#collection ⇒ String
readonly
Collection The name of the collection.
-
#filter ⇒ BSON::Document, Hash
readonly
Filter The query filter or command.
-
#options ⇒ Hash
readonly
Options The options.
Instance Method Summary collapse
-
#command ⇒ BSON::Document
Get the upconverted command.
-
#initialize(collection, filter, options) ⇒ Upconverter
constructor
Instantiate the upconverter.
Constructor Details
#initialize(collection, filter, options) ⇒ Upconverter
Instantiate the upconverter.
133 134 135 136 137 |
# File 'lib/mongo/protocol/delete.rb', line 133 def initialize(collection, filter, ) @collection = collection @filter = filter @options = end |
Instance Attribute Details
#collection ⇒ String (readonly)
Returns collection The name of the collection.
116 117 118 |
# File 'lib/mongo/protocol/delete.rb', line 116 def collection @collection end |
#filter ⇒ BSON::Document, Hash (readonly)
Returns filter The query filter or command.
119 120 121 |
# File 'lib/mongo/protocol/delete.rb', line 119 def filter @filter end |
#options ⇒ Hash (readonly)
Returns options The options.
122 123 124 |
# File 'lib/mongo/protocol/delete.rb', line 122 def @options end |
Instance Method Details
#command ⇒ BSON::Document
Get the upconverted command.
147 148 149 150 151 152 153 |
# File 'lib/mongo/protocol/delete.rb', line 147 def command document = BSON::Document.new document.store(DELETE, collection) document.store(DELETES, [ BSON::Document.new(Message::Q => filter, Message::LIMIT => limit) ]) document.store(Message::ORDERED, true) document end |