Module: Mongo::Operation::Find::Builder::Flags Private
- Defined in:
- lib/mongo/operation/find/builder/flags.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 converting Ruby options to wire protocol flags when sending find and related commands (e.g. explain).
Constant Summary collapse
- 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.
Options to cursor flags mapping.
{ allow_partial_results: [ :partial ], oplog_replay: [ :oplog_replay ], no_cursor_timeout: [ :no_cursor_timeout ], tailable: [ :tailable_cursor ], tailable_await: %i[await_data tailable_cursor], await_data: [ :await_data ], exhaust: [ :exhaust ], }.freeze
Class Method Summary collapse
-
.map_flags(options) ⇒ Array<Symbol>
private
Converts Ruby find options to an array of flags.
Class Method Details
.map_flags(options) ⇒ Array<Symbol>
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.
Converts Ruby find options to an array of flags.
Any keys in the input hash that are not options that map to flags are ignored.
45 46 47 48 49 50 |
# File 'lib/mongo/operation/find/builder/flags.rb', line 45 module_function def map_flags() MAPPINGS.each.each_with_object([:flags] || []) do |(key, value), flags| cursor_type = [:cursor_type] flags.push(*value) if [key] || (cursor_type && cursor_type == key) end end |