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

$all with array objects, differs in 2.4 and 2.5

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Major Change
    • ALL

      Some strange behavior around $all. Unclear to me what is right, but it does seem that 2.5 should not be matching this document. The way I see it is that "a" does not contain the object [""], it IS that object, thus this should not be matched.

      In 2.5:

      > db.repro.insert({_id: 0, a: [""]})
      > db.repro.find({a: {$all: [[""]]}})
      { "_id" : 0, "a" : [  "" ] }
      > db.runCommand({buildinfo: 1})
      {
              "version" : "2.5.5-pre-",
              "gitVersion" : "f65a0b814b8c77e3fbe90bca0c061c9b77f6acdb",
              "OpenSSLVersion" : "",
              "sysInfo" : "Darwin Andrew-Emil-MacBook-Pro.local 12.4.0 Darwin Kernel Version 12.4.0: Wed May  1 17:57:12 PDT 2013; root:xnu-2050.24.15~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49",
              "loaderFlags" : "-fPIC -pthread -Wl,-bind_at_load -mmacosx-version-min=10.6",
              "compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -pipe -O3 -Wno-unused-function -Wno-deprecated-declarations -mmacosx-version-min=10.6",
              "allocator" : "tcmalloc",
              "versionArray" : [
                      2,
                      5,
                      5,
                      -100
              ],
              "javascriptEngine" : "V8",
              "bits" : 64,
              "debug" : false,
              "maxBsonObjectSize" : 16777216,
              "ok" : 1
      }
      

      2.4:

      > mydb.repro.insert({_id: 0, a: [""]})
      > mydb.repro.find({a: {$all: [[""]]}})
      > mydb.runCommand({buildinfo: 1})
      {
              "version" : "2.4.9",
              "gitVersion" : "52fe0d21959e32a5bdbecdc62057db386e4e029c",
              "sysInfo" : "Darwin bs-osx-106-x86-64-2.10gen.cc 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun  7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49",
              "loaderFlags" : "-fPIC -pthread -rdynamic -m64",
              "compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -O3 -m64",
              "allocator" : "system",
              "versionArray" : [
                      2,
                      4,
                      9,
                      0
              ],
              "javascriptEngine" : "V8",
              "bits" : 64,
              "debug" : false,
              "maxBsonObjectSize" : 16777216,
              "ok" : 1
      }
      

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            andrew.emil@10gen.com Andrew Emil (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: