order_by is apparently ignored by drive queries
I was trying query the withdrawal documents and order by $updatedAt desc since I know this is a field that is indexed and I want the most recent (up to 100) withdrawal documents. I am using gRPCurl to fetch the data and instead of getting the most recent documents, I appear to be getting the first 100 documents in natural order.
Code to reproduce the issue.
echo '{"v0":{"prove":false,"data_contract_id":"NmK7YeF/rj6ilM9gMZf7CqttURgL2LYQTElEpi/i2X8=","document_type":"withdrawal","where":"gYNmc3RhdHVzYT0D","order_by":"gYJqJHVwZGF0ZWRBdGRkZXNj"}}'|grpcurl -import-path /var/www/dash.vote -d @ -proto .platform.proto 157.90.178.32:443 org.dash.platform.dapi.v0.Platform.getDocuments
Also, try it with omitting the order_by clause and see if it changes the order of the results, the where clause selects status=3 for COMPLETED documents, the order_by sorts on the $updatedAt column in descending order.
The workaround I am using for this now is to fetch documents using the offset start_after given a document ID as a parameter, allows me to skip already seen documents and breakthrough the 100 documents barrier.