File tree Expand file tree Collapse file tree 2 files changed +7
-9
lines changed
source/reference/operator Expand file tree Collapse file tree 2 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -18,18 +18,16 @@ $centerSphere
18
18
19
19
- The center point
20
20
21
- - The radian. To calculate the radian, divide the radius of
22
- the circle by the radius of the sphere.
23
-
24
- db.collection.find( { loc: { $within: { $centerSphere: [ [0,0], 10 / 3959 ] } } } )
21
+ - The angular distance in radians (distance along the surface of the
22
+ earth).
25
23
26
24
The following example returns all documents within a 10 mile radius
27
- of longitude ``88 W`` and latitude ``30 N``. The document determines
28
- the radian by dividing 10 miles by the approximate radius of the earth:
29
- 3960 miles.
25
+ of longitude ``88 W`` and latitude ``30 N``. The distance (10 miles)
26
+ is converted to radians by dividing by the approximate radius of the
27
+ earth (3959 miles) .
30
28
31
29
.. code-block:: javascript
32
30
33
- db.collection.find( { loc: { $within: { $centerSphere: [ [ 88 , 30 ], 10 / 3960 ] } } } )
31
+ db.collection.find( { loc: { $within: { $centerSphere: { [88,30 ], 10 /* miles */ / 3959 /* miles */ } } } } )
34
32
35
33
.. include:: /includes/note-geospatial-index-must-exist.rst
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ $within
35
35
36
36
db.collection.find( { location: { $within: { $center: [ center, radius } } } );
37
37
38
- - Circles measured by spherical geometry . Use the
38
+ - Circular distance on a sphere . Use the
39
39
:operator:`$centerSphere` operator. For the syntax, see :operator:`$centerSphere`.
40
40
41
41
- Polygons. Use the :operator:`$polygon` operator. Specify polygons with an array of points. See the
You can’t perform that action at this time.
0 commit comments