Method: Mongoid::Contextual::Aggregable::Mongo#max
- Defined in:
- lib/mongoid/contextual/aggregable/mongo.rb
#max(field = nil) ⇒ Float, 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.
66 67 68 |
# File 'lib/mongoid/contextual/aggregable/mongo.rb', line 66 def max(field = nil) block_given? ? super() : aggregates(field)["max"] end |