-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Query
-
None
Criteria#where has a string argument form, where the argument is given to the $where operator. This form does not negate itself when the where is preceded by a not.
Mongoid 7.0:
irb(main):011:0> Band.not.where('hello world') => #<Mongoid::Criteria selector: {"$where"=>"hello world"} options: {} class: Band embedded: false>
Expected behavior:
irb(main):001:0> Band.not.where('hello world') => #<Mongoid::Criteria selector: {"$and"=>[{"$nor"=>[{"$where"=>"hello world"}]}]} options: {} class: Band embedded: false>