Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order_by is apparently ignored by drive queries #2282

Open
kxcd opened this issue Oct 27, 2024 · 0 comments
Open

order_by is apparently ignored by drive queries #2282

kxcd opened this issue Oct 27, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@kxcd
Copy link

kxcd commented Oct 27, 2024

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.

@kxcd kxcd added the bug Something isn't working label Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant