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

$all with nested array behaves differently in 2.4 v 2.5

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 2.5.3, 2.5.4
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
    • Environment:
    • Operating System:
      ALL
    • Steps To Reproduce:
      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" ] }

      Description

      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).

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: