Class: Mongo::Collection::View::Aggregation
- Inherits:
-
Object
- Object
- Mongo::Collection::View::Aggregation
- 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.
Direct Known Subclasses
Defined Under Namespace
Modules: Behavior
Constant Summary
Constants included from Loggable
Constants included from Explainable
Explainable::ALL_PLANS_EXECUTION, Explainable::EXECUTION_STATS, Explainable::QUERY_PLANNER
Instance Attribute Summary collapse
-
#pipeline ⇒ Array<Hash>
readonly
Pipeline The aggregation pipeline.
Attributes included from Behavior
Attributes included from Mongo::CursorHost
Attributes included from Immutable
Instance Method Summary collapse
-
#initialize(view, pipeline, options = {}) ⇒ Aggregation
constructor
Initialize the aggregation for the provided collection view, pipeline and options.
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
Methods included from Iterable
Methods included from Mongo::CursorHost
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, = {}) perform_setup(view, ) 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<Hash> (readonly)
Returns pipeline The aggregation pipeline.
31 32 33 |
# File 'lib/mongo/collection/view/aggregation.rb', line 31 def pipeline @pipeline end |