Module: Mongoid::Contextual::Aggregable::None
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/mongoid/contextual/aggregable/none.rb |
Overview
Contains behavior for aggregating values in null context.
Instance Method Summary
-
#aggregates(_field) ⇒ Hash
Get all the aggregate values for the provided field in null context.
-
#avg(_field) ⇒ nil
Always returns nil.
-
#max(_field = nil)
Alias for #min.
-
#min(_field = nil) ⇒ nil
(also: #max)
Always returns nil.
-
#sum(_field = nil) ⇒ Integer
Always returns zero.
Instance Method Details
#aggregates(_field) ⇒ Hash
Get all the aggregate values for the provided field in null context. Provided for interface consistency with Mongo
.
# File 'lib/mongoid/contextual/aggregable/none.rb', line 18
def aggregates(_field) Aggregable::EMPTY_RESULT.dup end
#avg(_field) ⇒ nil
Always returns nil.
# File 'lib/mongoid/contextual/aggregable/none.rb', line 40
def avg(_field) nil end
#max(_field = nil)
Alias for #min.
# File 'lib/mongoid/contextual/aggregable/none.rb', line 62
alias :max :min
#min(_field = nil) ⇒ nil
Also known as: #max
Always returns nil.
# File 'lib/mongoid/contextual/aggregable/none.rb', line 51
def min(_field = nil) nil end
#sum(_field = nil) ⇒ Integer
Always returns zero.
# File 'lib/mongoid/contextual/aggregable/none.rb', line 29
def sum(_field = nil) 0 end