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.
130 131 132 133 134 |
# File 'lib/mongo/protocol/delete.rb', line 130 def initialize(collection, filter, ) @collection = collection @filter = filter = end |
Instance Attribute Details
#collection ⇒ String (readonly)
Returns collection The name of the collection.
113 114 115 |
# File 'lib/mongo/protocol/delete.rb', line 113 def collection @collection end |
#filter ⇒ BSON::Document, Hash (readonly)
Returns filter The query filter or command.
116 117 118 |
# File 'lib/mongo/protocol/delete.rb', line 116 def filter @filter end |
#options ⇒ Hash (readonly)
Returns options The options.
119 120 121 |
# File 'lib/mongo/protocol/delete.rb', line 119 def end |
Instance Method Details
#command ⇒ BSON::Document
Get the upconverted command.
144 145 146 147 148 149 150 |
# File 'lib/mongo/protocol/delete.rb', line 144 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 |