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

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

#specificationHash

Get the specification to pass to the aggregation operation.

Examples:

Get the specification.

builder.specification

Returns:

  • (Hash)

    The specification.

Since:

  • 2.2.0



78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mongo/collection/view/builder/aggregation.rb', line 78

def specification
  spec = {
    selector: aggregation_command,
    db_name: database.name,
    read: @options[:read_preference] || view.read_preference,
    session: @options[:session],
    collation: @options[:collation],
  }
  if write?
    spec.update(write_concern: write_concern)
  end
  spec
end