I'm using the REST API with SQL for Cosmos db and need to return a query's results ordered by a timestamp (which is stored as UNIX numeric timestamp). I'm trying to do this with a simple ORDER BY.
e.g. SELECT * FROM requests c ORDER BY c.timestamp
However with partitioning I get the error:
"Cross partition query with TOP/ORDER BY or aggregate functions is not supported."
In the collection settings the indexing precision for strings is set to -1, which was a suggestion from elsewhere, however the error is still thrown.
If I remove or set to false the x-ms-documentdb-query-enablecrosspartition header then I get:
"Cross partition query is required but disabled. Please set x-ms-documentdb-query-enablecrosspartition to true, specify x-ms-documentdb-partitionkey, or revise your query to avoid this exception."
Has anyone had any success doing this via the SQL REST API?
Thanks.