Method: Mongoid::Contextual::Aggregable::Memory#max
- Defined in:
- lib/mongoid/contextual/aggregable/memory.rb
#max(field = nil) ⇒ Numeric | Document
Get the max value of the provided field. If provided a block, will return the Document with the greatest value for the field, in accordance with Ruby’s enumerable API.
56 57 58 59 60 |
# File 'lib/mongoid/contextual/aggregable/memory.rb', line 56 def max(field = nil) return super() if block_given? aggregate_by(field, :max) end |