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

geoNear command and $geoNear agg stage should accept a "key" field

    • Fully Compatible
    • Query 2017-11-13, Query 2017-12-04, Query 2017-12-18

      The geoNear command and the $geoNear agg stage currently infer the field path over which to perform the search based on the presence of a "2d" or "2dsphere" index:

      https://github.com/mongodb/mongo/blob/88c39edf9275e47e5db4b1dbffb0bf51f9187731/src/mongo/db/commands/geo_near_cmd.cpp#L124-L130

      The command will fail if there are multiple geo indexes.

      In order to improve this behavior, we should extend the command and agg stage to accept an optional key field. This field must be a string, and will be interpreted as the field path over which to run the search. In order to avoid breaking existing applications, the existing behavior should be preserved when the key field is omitted.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: