Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
Description
$centerSphere examples wrong
The geo query operator $centerSphere is the spherical (3D) equivalent to $center (2D). Both are meant to be used with the $within operator (unlike for example $near or $nearSphere).
All references to $centerSphere in the docs I could find so far use a wrong example:
db.collection.find( { loc: { $centerSphere: { [0,0], 10 / 3959 } } } )
|
Instead, the example should read:
db.collection.find( { loc: { $within: { $centerSphere: [ [0,0], 10 / 3959 ] } } } )
|
Note there are two differences:
- the additional $within
- Using an array instead of a document as the value for $centerSphere
These are the links I found so far that need to be changed:
http://docs.mongodb.org/manual/reference/operator/centerSphere/
http://docs.mongodb.org/manual/core/geospatial-indexes/#distance-calculation
http://docs.mongodb.org/manual/reference/operators/#_S_centerSphere
There may be other references that I couldn't find.
$within docs don't mention $centerSphere
In addition, the docs on $within say they only support three shapes: $box, $center, $polygon. They should also mention the fourth one, $centerSphere with appropriate example.
Operators reference page ordering is confusing
Lastly, the operators page lists all the different operators, but the order is confusing. It mentions $near, then $within, and much further below $nearSphere and $centerSphere. This needs to be cleaned up as well.
The hierarchy should be:
- $near
- $nearSphere
- $within
- $center
- $centerSphere
- $box
- $polygon