[DOCS-934] Multiple $centerSphere examples are wrong and related issues with $within and $centerSphere Created: 03/Jan/13  Updated: 30/Oct/23  Resolved: 14/Feb/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Thomas Rueckstiess Assignee: Bob Grabar
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates DOCS-597 Corrections for geospatial examples i... Closed
is duplicated by DOCS-1065 Document db.serverStatus().metrics Closed
Related
Participants:
Days since reply: 11 years, 5 days ago

 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


 Comments   
Comment by auto [ 15/Feb/13 ]

Author:

{u'date': u'2013-01-14T21:34:03Z', u'name': u'Bob Grabar', u'email': u'bob.grabar@10gen.com'}

Message: DOCS-934 review edits
Branch: master
https://github.com/mongodb/docs/commit/82861e1be3e5a32e10848ac6e7c974792d6c44e1

Comment by auto [ 15/Feb/13 ]

Author:

{u'date': u'2013-01-11T02:54:49Z', u'name': u'Bob Grabar', u'email': u'bob.grabar@10gen.com'}

Message: DOCS-934 centerSphere and within
Branch: master
https://github.com/mongodb/docs/commit/cff05b3dc0c203c483e997bea7e712eede9a3054

Generated at Thu Feb 08 07:39:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.