Class: Mongo::Protocol::Query::Upconverter
- Inherits:
-
Object
- Object
- Mongo::Protocol::Query::Upconverter
- Defined in:
- lib/mongo/protocol/query.rb
Overview
Converts legacy query messages to the appropriare OP_COMMAND style message.
Constant Summary collapse
- OPTION_MAPPINGS =
Mappings of the options to the find command options.
{ :project => 'projection', :skip => 'skip', :limit => 'limit', :batch_size => 'batchSize' }.freeze
- SPECIAL_FIELD_MAPPINGS =
{ :$readPreference => 'readPreference', :$orderby => 'sort', :$hint => 'hint', :$comment => 'comment', :$returnKey => 'returnKey', :$snapshot => 'snapshot', :$maxScan => 'maxScan', :$max => 'max', :$min => 'min', :$maxTimeMS => 'maxTimeMS', :$showDiskLoc => 'showRecordId', :$explain => 'explain' }.freeze
- FLAG_MAPPINGS =
Mapping of flags to find command options.
{ :tailable_cursor => 'tailable', :oplog_replay => 'oplogReplay', :no_cursor_timeout => 'noCursorTimeout', :await_data => 'awaitData', :partial => 'allowPartialResults' }.freeze
- FIND =
Find command constant.
'find'.freeze
- FILTER =
Filter attribute constant.
'filter'.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.
-
#flags ⇒ Array<Symbol>
readonly
Flags The flags.
-
#options ⇒ BSON::Document, Hash
readonly
Options The options.
Instance Method Summary collapse
-
#command ⇒ BSON::Document
Get the upconverted command.
-
#command_name ⇒ String, Symbol
Get the name of the command.
-
#initialize(collection, filter, options, flags) ⇒ Upconverter
constructor
Instantiate the upconverter.
Constructor Details
#initialize(collection, filter, options, flags) ⇒ Upconverter
Instantiate the upconverter.
226 227 228 229 230 231 |
# File 'lib/mongo/protocol/query.rb', line 226 def initialize(collection, filter, , flags) @collection = collection @filter = filter @options = @flags = flags end |
Instance Attribute Details
#collection ⇒ String (readonly)
Returns collection The name of the collection.
204 205 206 |
# File 'lib/mongo/protocol/query.rb', line 204 def collection @collection end |
#filter ⇒ BSON::Document, Hash (readonly)
Returns filter The query filter or command.
207 208 209 |
# File 'lib/mongo/protocol/query.rb', line 207 def filter @filter end |
#flags ⇒ Array<Symbol> (readonly)
Returns flags The flags.
213 214 215 |
# File 'lib/mongo/protocol/query.rb', line 213 def flags @flags end |
#options ⇒ BSON::Document, Hash (readonly)
Returns options The options.
210 211 212 |
# File 'lib/mongo/protocol/query.rb', line 210 def @options end |
Instance Method Details
#command ⇒ BSON::Document
Get the upconverted command.
241 242 243 |
# File 'lib/mongo/protocol/query.rb', line 241 def command command? ? op_command : find_command end |