mongoid / origin

A Ruby DSL for building MongoDB queries
http://mongoid.org/en/origin/index.html
MIT License
62 stars 29 forks source link

negation (.not) doesn't work for gt, gte, lt, lte operators #70

Closed humanbagel closed 11 years ago

humanbagel commented 11 years ago

In the docs for negation, the example given is

queryable.not.gt(age: 50)
queryable.selector #=> { "age" => { "$not" => { "$gt" => 50 }}}

However here's what I get (on origin 1.0.11 and mongoid 3.0.19)

Person.not.gt(age: 50).selector #=> {"age"=>{"$gt"=>50}}
Person.not.lte(age: 50).selector #=> {"age"=>{"$lte"=>50}}

However, negation of "in" works:

Person.not.in(email_address: "me@me.com").selector #=> {"email_address"=>{"$not"=>{"$in"=>["me@me.com"]}}}
arthurnn commented 11 years ago

Closing this ticket for now, as pr #73 should fix it.

thanks for the report.