Module: Mongo::Operation::Find::Builder::Modifiers Private
- Defined in:
- lib/mongo/operation/find/builder/modifiers.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Provides behavior for mapping Ruby options to legacy OP_QUERY find modifiers.
This module is used in two ways:
-
When Collection#find is invoked with the legacy OP_QUERY syntax (:$query argument etc.), this module is used to map the legacy parameters into the Ruby options that normally are used by applications.
-
When sending a find operation using the OP_QUERY protocol, this module is used to map the Ruby find options to the modifiers in the wire protocol message.
Constant Summary collapse
- DRIVER_MAPPINGS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mappings from Ruby options to OP_QUERY modifiers.
BSON::Document.new( comment: '$comment', explain: '$explain', hint: '$hint', max_scan: '$maxScan', max_time_ms: '$maxTimeMS', max_value: '$max', min_value: '$min', return_key: '$returnKey', show_disk_loc: '$showDiskLoc', snapshot: '$snapshot', sort: '$orderby', ).freeze
- SERVER_MAPPINGS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mappings from OP_QUERY modifiers to Ruby options.
BSON::Document.new(DRIVER_MAPPINGS.invert).freeze
Class Method Summary collapse
-
.map_driver_options(modifiers) ⇒ BSON::Document
private
Transform the provided OP_QUERY modifiers to Ruby options.
-
.map_server_modifiers(options) ⇒ BSON::Document
private
Transform the provided Ruby options into a document of OP_QUERY modifiers.
Class Method Details
.map_driver_options(modifiers) ⇒ BSON::Document
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Transform the provided OP_QUERY modifiers to Ruby options.
64 65 66 |
# File 'lib/mongo/operation/find/builder/modifiers.rb', line 64 module_function def (modifiers) Options::Mapper.transform_documents(modifiers, SERVER_MAPPINGS) end |
.map_server_modifiers(options) ⇒ BSON::Document
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Transform the provided Ruby options into a document of OP_QUERY modifiers.
Accepts both string and symbol keys.
The input mapping may contain additional keys that do not map to OP_QUERY modifiers, in which case the extra keys are ignored.
82 83 84 |
# File 'lib/mongo/operation/find/builder/modifiers.rb', line 82 module_function def map_server_modifiers() Options::Mapper.transform_documents(, DRIVER_MAPPINGS) end |