[SERVER-12440] 2.5 $nor with geoNear breaks due to it not being top level Created: 22/Jan/14  Updated: 10/Dec/14  Resolved: 23/Jan/14

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

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

Issue Links:
Related
Operating System: ALL
Participants:

 Description   

Seems that $nor in 2.5 does not make exceptions to allow for the inside queries to be "top level"

In 2.4:

 
> db.test.find({"$nor":[{"loc":{"$nearSphere":{"$geometry":{"type":"Point","coordinates":[0,0]},"$maxDistance":0}}}]}) 
> 

In 2.5:

 
> db.test.find({"$nor":[{"loc":{"$nearSphere":{"$geometry":{"type":"Point","coordinates":[0,0]},"$maxDistance":0}}}]}) 
error: { 
        "$err" : "Can't canonicalize query: BadValue geoNear must be top-level expr", 
        "code" : 17287 
} 
> 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 Daniel Pasette (Inactive) [ 23/Jan/14 ]

This never worked properly in 2.4, but was not explicitly rejected. rassi@10gen.com already added a test here.

https://github.com/mongodb/mongo/blob/df45324b26d66f8a5155a0a9799b0ba000544ebb/src/mongo/db/query/canonical_query_test.cpp#L191

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