Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-934

Multiple $centerSphere examples are wrong and related issues with $within and $centerSphere

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • Server_Docs_20231030
    • None
    • manual
    • 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

      Attachments

        Activity

          People

            bgrabar Bob Grabar
            thomas.rueckstiess@mongodb.com Thomas Rueckstiess
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              11 years, 5 days ago