Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure document DB orderby timestamp field

I have a timestamp field in my each document. the timestamp is in ISODate format. Is there any way i can sort the data using it in Document Explorer or Query Explorer?

like image 970
Dushyant Bangal Avatar asked May 27 '16 06:05

Dushyant Bangal


2 Answers

Each document has a default timestamp field named '_ts'. You can for instance get last documents with the following query:

SELECT * FROM c ORDER BY c._ts DESC

like image 89
quent Avatar answered Nov 13 '22 19:11

quent


If you have a full precision (-1) index on your ISO date string field ORDER BY works as expected.

like image 37
Larry Maccherone Avatar answered Nov 13 '22 19:11

Larry Maccherone