Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-11737

$not unable to be chained in 2.4 version

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.9
    • Component/s: Querying
    • Labels:
    • Environment:
    • ALL
    • Hide

      2.4.9-pre-

      > db.c.insert({b:0})
      > db.c.find({b:{$not:{$not:{$gt:-1000}}}})
      error: { "$err" : "invalid use of $not", "code" : 13034 }
      

      2.5.4-pre-

      > db.c.insert({b:0})
      > db.c.find({b:{$not:{$not:{$gt:-1000}}}})
      { "_id" : ObjectId("5286a1a522d7b1bbbfb7813a"), "b" : 0 }
      
      Show
      2.4.9-pre- > db.c.insert({b:0}) > db.c.find({b:{$not:{$not:{$gt:-1000}}}}) error: { "$err" : "invalid use of $not" , "code" : 13034 } 2.5.4-pre- > db.c.insert({b:0}) > db.c.find({b:{$not:{$not:{$gt:-1000}}}}) { "_id" : ObjectId( "5286a1a522d7b1bbbfb7813a" ), "b" : 0 }

      Query behavior discrepancy: $not operators are able to be chained together in 2.5.x, but this isn't possible in 2.4. Intuitively, it seems that the 2.5.x behavior is correct and that either 2.4 should be fixed or there should be some docs explaining the new behavior (and this ticket can be moved to DOCS).

            Assignee:
            Unassigned Unassigned
            Reporter:
            luke.lovett Luke Lovett
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: