Method: Mongoid::Criterion::Optional#limit
- Defined in:
- lib/mongoid/criterion/optional.rb
#limit(value = 20) ⇒ Object
Adds a criterion to the Criteria that specifies the maximum number of results to return. This is mostly used in conjunction with skip() to handle paginated results.
Options:
value: An Integer specifying the max number of results. Defaults to 20.
Example:
criteria.limit(100)
Returns: self
90 91 92 |
# File 'lib/mongoid/criterion/optional.rb', line 90 def limit(value = 20) @options[:limit] = value; self end |