Support ORDER BY on the ST_DISTANCE spatial function
Ordering results by the ST_DISTANCE spatial function is currently not supported.
This item was incorrectly marked as started. Actual work on this item has been deferred but is still planned.
Will update when this work is started.
We have a requirement to do "sort" on distances between user entered "point" [lat/long] and a list of lat/longs in cosmso DB. Since SQL API does not support this, we are forced to go the mongoDB API on cosmos route for this "collection" that requires this functionality: https://docs.mongodb.com/manual/tutorial/geospatial-tutorial/#sorted-with-nearsphere
Emre Altan commented
Any update on timing? This feature is business critical for our application.
I had to ditch Cosmos because of this issue - seems like a dealbreaker to me - has ther been any movement on this?
This is required to create any serious geo-spatial applications. This should not have been ignored for almost 3 years. If you expect users to adopt your NoSQL platform, please try harder to implement these important features.
It is a post of 2016. Still no one implemented this? Microsoft this is sad.
Mitesh Patekar commented
We need this ! very important
Waiting too long...
As soon as an application deals with geodata it is likely that you will need the functionality to sort Locations by their distance towards a reference-Location. You cannot do this on the application-level because this would quickly break your appliation once you have a few million records. As long as DocumentDB does not support ORDER BY on the ST_DISTANCE spatial function I cannot recommend DocumentDB as backend for applications that deal with geodata.
Jack Bond commented
Can someone from the Cosmos team give a time frame for this? Thanks.
dany pavro commented
I'm waiting for this feature sooo long
Shashank Yerramilli commented
This would improve experience with document db a lot
Carl Edwards commented
This would be very useful for us also and we would be using it from LINQ.
Currently we have adopted one of the workarounds using an anonymous type in a Select to store the distance and then sort outside of DocumentDB but clearly this will not work for large result sets or allow paging. Also having the server calculate the distance twice feels wrong.
Any updates on when this will be supported? Tentative atleast?
This is quite necessary
It is not currently possible to order results by distance to a point. This makes spatial querying quite limited