Class: Mongo::Collection::View::Builder::Aggregation
- Inherits:
-
Object
- Object
- Mongo::Collection::View::Builder::Aggregation
- Extended by:
- Forwardable
- Defined in:
- lib/mongo/collection/view/builder/aggregation.rb
Overview
Builds an aggregation command specification from the view and options.
Constant Summary collapse
- MAPPINGS =
The mappings from ruby options to the aggregation options.
BSON::Document.new( :allow_disk_use => 'allowDiskUse', :max_time_ms => 'maxTimeMS', :explain => 'explain', :bypass_document_validation => 'bypassDocumentValidation' ).freeze
Instance Attribute Summary collapse
-
#options ⇒ Hash
readonly
Options The map/reduce specific options.
-
#pipeline ⇒ Array<Hash>
readonly
Pipeline The pipeline.
-
#view ⇒ Collection::View
readonly
View The collection view.
Instance Method Summary collapse
-
#initialize(pipeline, view, options) ⇒ Aggregation
constructor
Initialize the builder.
-
#specification ⇒ Hash
Get the specification to pass to the aggregation operation.
Constructor Details
#initialize(pipeline, view, options) ⇒ Aggregation
Initialize the builder.
57 58 59 60 61 |
# File 'lib/mongo/collection/view/builder/aggregation.rb', line 57 def initialize(pipeline, view, ) @pipeline = pipeline @view = view = end |
Instance Attribute Details
#options ⇒ Hash (readonly)
Returns options The map/reduce specific options.
45 46 47 |
# File 'lib/mongo/collection/view/builder/aggregation.rb', line 45 def end |
#pipeline ⇒ Array<Hash> (readonly)
Returns pipeline The pipeline.
39 40 41 |
# File 'lib/mongo/collection/view/builder/aggregation.rb', line 39 def pipeline @pipeline end |
#view ⇒ Collection::View (readonly)
Returns view The collection view.
42 43 44 |
# File 'lib/mongo/collection/view/builder/aggregation.rb', line 42 def view @view end |
Instance Method Details
#specification ⇒ Hash
Get the specification to pass to the aggregation operation.
71 72 73 |
# File 'lib/mongo/collection/view/builder/aggregation.rb', line 71 def specification { selector: aggregation_command, db_name: database.name, read: read } end |