Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9842

Inconsistent and undocumented behavior of Geo indexes and Geo queries

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.3
    • Component/s: Aggregation Framework, Geo
    • Labels:
      None
    • ALL

      The behavior of Geo indexes is inconsistent and is not enforced by the code.

      The ensureIndex() command will let you create multiple 2d and 2dsphere indexes on a collection.

      If you query the collection with $geoNear, it will error out if there are multiple 2d indexes, and will silently ignore the 2dsphere index if there is both a 2d and a 2dsphere index

      If you query a collection with $nearSphere, you can use a collection with multiple 2d indexes; the index selected for the query depends on the query field specified in $nearSphere.

      This should be made (at the least) consistent; ideally MongoDB should:

      • Support multiple Geo indexes on a single collection
      • Allow the $geoNear command to specify which field to use for the query (in the same way that the $nearSphere command does

      If MongoDB is going to have a limit of one Geo index per collection, it should enforce that limit when ensureIndex() is called, and not when the collection is queried.

      EDIT: Radically revised problem description

            Assignee:
            Unassigned Unassigned
            Reporter:
            william.zola@10gen.com William Zola
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: