-
Type: Improvement
-
Resolution: Unresolved
-
Priority: 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.