Method: Mongoid::Criteria::Queryable::Selectable#gt

Defined in:
lib/mongoid/criteria/queryable/selectable.rb

#gt(criterion) ⇒ Selectable

Add the $gt criterion to the selector.

Examples:

Add the $gt criterion.

selectable.gt(age: 60)

Execute an $gt in a where query.

selectable.where(:field.gt => 10)

Parameters:

  • The field/value pairs to check.

Returns:

  • The cloned selectable.



277
278
279
280
281
282
283
# File 'lib/mongoid/criteria/queryable/selectable.rb', line 277

def gt(criterion)
  if criterion.nil?
    raise Errors::CriteriaArgumentRequired, :gt
  end

  and_with_operator(criterion, "$gt")
end