Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
-
MongoDB 2.2
Description
On page http://docs.mongodb.org/manual/core/geospatial-indexes/#distance-calculation one can read:
db.places.find( { loc: { $centerSphere: [ [ -74, 40.74 ] ,
|
100 / 3963.192 ] } } )
|
Running this command in the mongo shell produces the following error:
error: { "$err" : "geo field only has 1 element", "code" : 13068 }
|
The correct query has to be:
db.places.find( { loc: {$within: { $centerSphere: [ [ -74, 40.74 ] ,
|
100 / 3963.192 ] } } })
|
There needs to be a {$within: ...} wrapped around {$centerSphere: ...}.