Specifying `not` multiple times does not toggle negation state

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 9.1.0, 9.0.4, 8.1.8
    • Affects Version/s: 9.0.0, 8.1.5
    • Component/s: Query
    • None
    • Ruby Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      From the GitHub forums:

      "What is expected when you use 2 not operators in sequence like User.not.not.where(field: true)? Shouldn't the query User.where(foo: true) be equivalent to User.not.not.where(foo:true)? I am finding that this is not the case, and am wondering if this usage of the not operator is unsupported or if this is a bug?"

      I've confirmed this is a bug – specifying not a second time does not toggle the criteria's negation state as it should.

      See: https://github.com/mongodb/mongoid/blob/master/lib/mongoid/criteria/queryable/selectable.rb#L556

              Assignee:
              Darshana Venkatesh
              Reporter:
              Jamis Buck
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: