Aggregation — Documentation by YARD 0.9.37 (original) (raw)

Class: Mongo::Collection::View::Aggregation

Inherits:

Object

Includes:

Behavior

Defined in:

lib/mongo/collection/view/aggregation.rb,
lib/mongo/collection/view/aggregation/behavior.rb

Overview

Provides behavior around an aggregation pipeline on a collection view.

Defined Under Namespace

Modules: Behavior

Constant Summary

Constants included from Loggable

Loggable::PREFIX

Constants included from Explainable

Explainable::ALL_PLANS_EXECUTION, Explainable::EXECUTION_STATS, Explainable::QUERY_PLANNER

Instance Attribute Summary collapse

Attributes included from Behavior

#view

Attributes included from Mongo::CursorHost

#cursor, #timeout_mode

Attributes included from Immutable

#options

Instance Method Summarycollapse

Methods included from Behavior

#allow_disk_use, #explain, #timeout_ms, #write?

Methods included from Retryable

#read_worker, #select_server, #write_worker

Methods included from Loggable

#log_debug, #log_error, #log_fatal, #log_info, #log_warn, #logger

Methods included from Explainable

#explain

Methods included from Iterable

#close_query, #each

Methods included from Mongo::CursorHost

#validate_timeout_mode!

Constructor Details

#initialize(view, pipeline, options = {}) ⇒ Aggregation

Initialize the aggregation for the provided collection view, pipeline and options.

| 68 69 70 71 72 73 74 75 | # File 'lib/mongo/collection/view/aggregation.rb', line 68 def initialize(view, pipeline, options = {}) perform_setup(view, options) do @pipeline = pipeline.dup unless Mongo.broken_view_aggregate || view.filter.empty? @pipeline.unshift(:$match => view.filter) end end end | | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

Instance Attribute Details

#pipeline ⇒ Array

Returns pipeline The aggregation pipeline.

31 32 33 # File 'lib/mongo/collection/view/aggregation.rb', line 31 def pipeline @pipeline end