In 7.3 one of the changes is using $eq instead of implicit equality. This can't actually be done because the two operators are not equivalent, specifically they treat regular expressions differently.
However, the grouped negation is a good feature, and replacing $ne with nor(and(implicit)) I think is correct.
serene% mongoid=master rails c Loading development environment (Rails 6.0.3.4) irb(main):001:0> Band.where(year:2020, :year.gt => 2020) => #<Mongoid::Criteria selector: {"year"=>{"$eq"=>2020, "$gt"=>2020}} options: {} class: Band embedded: false> irb(main):002:0> Band.where(year: /2020/, :year.gt => 2020) => #<Mongoid::Criteria selector: {"year"=>{"$eq"=>/2020/, "$gt"=>2020}} options: {} class: Band embedded: false> irb(main):003:0> serene% rails c Loading development environment (Rails 6.0.3.4) irb(main):001:0> Band.where(year: /2020/, :year.gt => 2020) => #<Mongoid::Criteria selector: {"year"=>/2020/, "$and"=>[{"year"=>{"$gt"=>2020}}]} options: {} class: Band embedded: false>
- is caused by
-
MONGOID-5020 Condition lifting breaks with symbol operators on Ruby <= 2.6
- Closed
- links to