module Mongo::Operation::Find::Builder::Flags
Provides behavior for converting Ruby options to wire protocol flags when sending find and related commands (e.g. explain).
@api private
Constants
- MAPPINGS
Options to cursor flags mapping.
Public Instance Methods
map_flags(options)
click to toggle source
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.
@param [ Hash, BSON::Document ] options The options.
@return [ Array<Symbol> ] The flags.
# File lib/mongo/operation/find/builder/flags.rb, line 47 def map_flags(options) MAPPINGS.each.reduce(options[:flags] || []) do |flags, (key, value)| cursor_type = options[:cursor_type] if options[key] || (cursor_type && cursor_type == key) flags.push(*value) end flags end end