Method: Mongo::Collection::View::Builder::MapReduce#specification

Defined in:
lib/mongo/collection/view/builder/map_reduce.rb

#specificationHash

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

Examples:

Get the specification.

builder.specification

Returns:

  • (Hash)

    The specification.

Since:

  • 2.2.0



82
83
84
85
86
87
88
89
90
91
92
# File 'lib/mongo/collection/view/builder/map_reduce.rb', line 82

def specification
  spec = {
    selector: map_reduce_command,
    db_name: database.name,
    # Note that selector just above may also have a read preference
    # specified, per the #map_reduce_command method below.
    read: read,
    session: options[:session]
  }
  write?(spec) ? spec.merge!(write_concern: write_concern) : spec
end