Module: Daodalus::DSL::Aggregations
- Included in:
- Daodalus::DSL, Daodalus::DSL::Aggregation::Group, Daodalus::DSL::Aggregation::Limit, Daodalus::DSL::Aggregation::Match, Daodalus::DSL::Aggregation::Project, Daodalus::DSL::Aggregation::Skip, Daodalus::DSL::Aggregation::Sort, Daodalus::DSL::Aggregation::Unwind
- Defined in:
- lib/daodalus/dsl/aggregations.rb
Instance Method Summary collapse
- #aggregate ⇒ Object
- #group(keys) ⇒ Object (also: #group_by)
- #limit(limit) ⇒ Object
- #match(field = nil) ⇒ Object
- #pipeline ⇒ Object
- #project(*keys) ⇒ Object
- #skip(skip) ⇒ Object
- #sort(sort) ⇒ Object
- #unwind(field) ⇒ Object
Instance Method Details
#aggregate ⇒ Object
5 6 7 |
# File 'lib/daodalus/dsl/aggregations.rb', line 5 def aggregate dao.aggregate(pipeline) end |
#group(keys) ⇒ Object Also known as: group_by
13 14 15 |
# File 'lib/daodalus/dsl/aggregations.rb', line 13 def group(keys) Aggregation::Group.new(dao, pipeline, keys, {}) end |
#limit(limit) ⇒ Object
22 23 24 |
# File 'lib/daodalus/dsl/aggregations.rb', line 22 def limit(limit) Aggregation::Limit.new(dao, pipeline, limit) end |
#match(field = nil) ⇒ Object
9 10 11 |
# File 'lib/daodalus/dsl/aggregations.rb', line 9 def match(field=nil) Aggregation::Match.new(dao, pipeline, Query.new, field) end |
#pipeline ⇒ Object
38 39 40 |
# File 'lib/daodalus/dsl/aggregations.rb', line 38 def pipeline aggregations + [to_aggregation] end |
#project(*keys) ⇒ Object
18 19 20 |
# File 'lib/daodalus/dsl/aggregations.rb', line 18 def project(*keys) Aggregation::Project.new(dao, pipeline, keys) end |
#skip(skip) ⇒ Object
26 27 28 |
# File 'lib/daodalus/dsl/aggregations.rb', line 26 def skip(skip) Aggregation::Skip.new(dao, pipeline, skip) end |
#sort(sort) ⇒ Object
30 31 32 |
# File 'lib/daodalus/dsl/aggregations.rb', line 30 def sort(sort) Aggregation::Sort.new(dao, pipeline, sort) end |
#unwind(field) ⇒ Object
34 35 36 |
# File 'lib/daodalus/dsl/aggregations.rb', line 34 def unwind(field) Aggregation::Unwind.new(dao, pipeline, field) end |