-
Type: Bug
-
Resolution: Unresolved
-
Priority: Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: Query
Mongoid has a handy shortcut to convert Range objects to a $gte/$lte pair:
irb(main):070:0> job.tasks.where(hour: 10..15) => #<Mongoid::Criteria selector: {"hour"=>{"$gte"=>10, "$lte"=>15}} options: {} class: Task embedded: true>
Unfortunately, when the Range object is an argument of a field-level operator, the result is a bogus query:
irb(main):071:0> job.tasks.where(hour: {'$eq':10..15}) => #<Mongoid::Criteria selector: {"hour"=>{:$eq=>{"$gte"=>10, "$lte"=>15}}} options: {} class: Task embedded: true>
The latter case should ideally be detected and raise an exception during query construction.
- related to
-
MONGOID-4781 Make embedded matchers work the same as MongoDB server queries
- Released