|
Currently, $geoNear queries return an empty result set if the collection does not exist. These queries should return an error instead, as all $geoNear queries must be answered with an index.
Reproduce as follows:
> db.foo.drop()
|
false
|
> db.foo.find({a: {$near: [0, 0]}}) // Returns no error (unexpected).
|
> db.createCollection("foo")
|
{ "ok" : 1 }
|
> db.foo.find({a: {$near: [0, 0]}}) // Returns error (expected).
|
Error: error: {
|
"waitedMS" : NumberLong(0),
|
"ok" : 0,
|
"errmsg" : "error processing query: ns=test.fooTree: GEONEAR field=a maxdist=1.79769e+308 isNearSphere=0\nSort: {}\nProj: {}\n planner returned error: unable to find index for $geoNear query",
|
"code" : 2
|
}
|
One possible implementation strategy would be to extend ExtensionsCallback with a new method "parseGeoNear()" which returns a not-OK status if the collection does not exist.
|