$all with nested array behaves differently in 2.4 v 2.5

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.5.3, 2.5.4
    • Component/s: Querying
    • Environment:
    • ALL
    • Hide

      2.5.5-pre-

      > db.c.insert({a:["red","blue"]})
      > db.c.insert({a:["red"]})
      > db.c.count({a:{$all:[["red"]]}})
      { "_id" : ObjectId("528c0a6e1d37e39f262901af"), "a" : [  "red" ] }
      > db.c.count({a:{$all:["red"]}})
      { "_id" : ObjectId("528c0a661d37e39f262901ae"), "a" : [  "red",  "blue" ] }
      { "_id" : ObjectId("528c0a6e1d37e39f262901af"), "a" : [  "red" ] }
      

      2.4.9-pre-

      > db.c.insert({a:["red","blue"]})
      > db.c.insert({a:["red"]})
      > db.c.find({a:{$all:[["red"]]}})
      > db.c.find({a:{$all:["red"]}})
      { "_id" : ObjectId("528c0a3b679ed5d9487c0be4"), "a" : [  "red",  "blue" ] }
      { "_id" : ObjectId("528c0a44679ed5d9487c0be5"), "a" : [  "red" ] }
      
      Show
      2.5.5-pre- > db.c.insert({a:[ "red" , "blue" ]}) > db.c.insert({a:[ "red" ]}) > db.c.count({a:{$all:[[ "red" ]]}}) { "_id" : ObjectId( "528c0a6e1d37e39f262901af" ), "a" : [ "red" ] } > db.c.count({a:{$all:[ "red" ]}}) { "_id" : ObjectId( "528c0a661d37e39f262901ae" ), "a" : [ "red" , "blue" ] } { "_id" : ObjectId( "528c0a6e1d37e39f262901af" ), "a" : [ "red" ] } 2.4.9-pre- > db.c.insert({a:[ "red" , "blue" ]}) > db.c.insert({a:[ "red" ]}) > db.c.find({a:{$all:[[ "red" ]]}}) > db.c.find({a:{$all:[ "red" ]}}) { "_id" : ObjectId( "528c0a3b679ed5d9487c0be4" ), "a" : [ "red" , "blue" ] } { "_id" : ObjectId( "528c0a44679ed5d9487c0be5" ), "a" : [ "red" ] }
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      The $all query operator can return different results in 2.4 v 2.5 versions of mongodb when given a nested array as an argument. Not sure which behavior is "correct" here, but want to confirm that this change is intentional and that this change gets documented somewhere (and this may become a DOCS ticket).

            Assignee:
            David Storch
            Reporter:
            Luke Lovett (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: