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 => [ :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.
48 49 50 51 52 53 54 55 56 |
# File 'lib/mongo/operation/find/builder/flags.rb', line 48 module_function def map_flags() MAPPINGS.each.reduce([:flags] || []) do |flags, (key, value)| cursor_type = [:cursor_type] if [key] || (cursor_type && cursor_type == key) flags.push(*value) end flags end end |