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

$near command should support defining which properties to use for x and y

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • Affects Version/s: None
    • Component/s: Geo
    • None
    • Query Execution
    • Fully Compatible

      Currently the documentation regarding geospatial index says:

      {blockquote}
      In order to use the index, you need to have a field in your object that is either a sub-object or array where the first 2 elements are x,y coordinates (or y,x - just be consistent; it might be advisible to use order-preserving dictionaries/hashes in your client code, to ensure consistency).{blockquote}

      This feels a bit weird as in no other place of document usage field order actually matters. So in case the location is a nested document it would be cool if we could specify the the properties to be used for comparison on index definition side or when querying:

      Index: {'location' : '2d' }, Options: { "name" : "location" , "min" : -180 , "max" : 180, "x" : "foo", "y" : "bar"}
      

      or

      {'location' : { '$near' : { 'foo' : 10, 'bar' : 12}}}
      

      I'd prefer the former as this wouldn't require the mapping information to be restated for every query.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            oliver.gierke Oliver Gierke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: