Class Mongo::Collection::View::Builder::MapReduce
In: lib/mongo/collection/view/builder/map_reduce.rb
Parent: Object

Builds a map/reduce specification from the view and options.

@since 2.2.0

Methods

Constants

MAPPINGS = BSON::Document.new( finalize: 'finalize', js_mode: 'jsMode', out: 'out', scope: 'scope', verbose: 'verbose', bypass_document_validation: 'bypassDocumentValidation', collation: 'collation'   The mappings from ruby options to the map/reduce options.

@since 2.2.0

OUT_ACTIONS = [ :replace, :merge, :reduce ].freeze

Attributes

map  [R]  @return [ String ] map The map function.
options  [R]  @return [ Hash ] options The map/reduce specific options.
reduce  [R]  @return [ String ] reduce The reduce function.
view  [R]  @return [ Collection::View ] view The collection view.

Public Class methods

Initialize the builder.

@example Initialize the builder.

  MapReduce.new(map, reduce, view, options)

@param [ String ] map The map function. @param [ String ] reduce The reduce function. @param [ Collection::View ] view The collection view. @param [ Hash ] options The map/reduce options.

@since 2.2.0

Public Instance methods

Get the specification for issuing a find command on the map/reduce results.

@example Get the command specification.

  builder.command_specification

@return [ Hash ] The specification.

@since 2.2.0

Get the specification for the document query after a map/reduce.

@example Get the query specification.

  builder.query_specification

@return [ Hash ] The specification.

@since 2.2.0

Get the specification to pass to the map/reduce operation.

@example Get the specification.

  builder.specification

@return [ Hash ] The specification.

@since 2.2.0

[Validate]