[SERVER-12444] null equality matches on dotted queries different in 2.4 vs 2.5.5-pre Created: 22/Jan/14  Updated: 12/Aug/14  Resolved: 28/Jan/14

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Andrew Emil (Inactive) Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: 26qa
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-11422 $gte is behaving differently comparin... Closed
is duplicated by SERVER-14406 Differences in null matching between ... Closed
is duplicated by SERVER-14874 Querying on {$ne:null} on embedded do... Closed
Related
related to SERVER-11777 Null matching on fields in docs in ar... Closed
is related to SERVER-11414 $lt/$gt behaves differently when comp... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

Different results get returned for identical query, seems to me that the 2.4 result is more correct than the 2.5.5-pre one here.

In 2.4.9:

> db.repro.insert({ "_id" : 0, "c" : [ 0,1 ] })
> db.repro.find({"c.c":null})
{ "_id" : 0, "c" : [  0,  1 ] }
> db.version()
2.4.9

In 2.5:

> db.repro.insert({ "_id" : 0, "c" : [ 0,1 ] })
> db.repro.find({"c.c":null})
> 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
}



 Comments   
Comment by Benety Goh [ 24/Jan/14 ]
{c.c: null}

is matching the empty BSON object (which contains an implied EOO BSON marker).

Should the query be done using $exists instead?

Comment by Daniel Pasette (Inactive) [ 23/Jan/14 ]

I'd expect both docs to be returned, but only the second one is.

> db.t.save({ "_id" : 0, "c" : [ 0, 1 ] })
> db.t.save({ "_id" : 1, "c" : [ 1, {  }, { "d" : 1 }, "a" ] })
> db.t.find({'c.c':null})
{ "_id" : 1, "c" : [ 1, {  }, { "d" : 1 }, "a" ] }

Looks like a matcher bug where none of the elements are sub-documents?

Comment by Andrew Emil (Inactive) [ 22/Jan/14 ]

Seems related to 11777 though results are different

Generated at Thu Feb 08 03:28:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.