Method: Mongoid::Criteria::Queryable::Selectable#lt

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

#lt(criterion) ⇒ Selectable

Add the $lt criterion to the selector.

Examples:

Add the $lt criterion.

selectable.lt(age: 60)

Execute an $lt in a where query.

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

Parameters:

  • criterion (Hash)

    The field/value pairs to check.

Returns:



353
354
355
356
357
358
359
# File 'lib/mongoid/criteria/queryable/selectable.rb', line 353

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

  and_with_operator(criterion, "$lt")
end