
I am getting this error Query is not defined
, when I try to retrieve the documents
I am not sure why, here is my function
let promise = databases.listDocuments(
"647ac763cf53edxxxx",
"647ac820ba38520xxxxx",
[
Query.orderDesc("age")
]
);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});```

Have you created an index for the age attribute?

yes

but none of the queries are working

Are you appwrite cloud or its self hosted?

cloud

Do you import Query ?

you mean here const { Client, Account, ID, Functions, Databases} = Appwrite;
?

I imported it now it works

thanks😅
Recommended threads
- Getting “Internal Error 500” for all ser...
SDK error is “Access to this resource is block” - but the credentials and same script was working fine before (there’s been no changes my side). The Console sys...
- DATABASE ERROR
When I select NULL as the value and click update, it shows that the update is successful, but when I refresh it changes back to add-avatar. It seems that all fi...
- Error while updating documents from Appw...
while trying to update the document in a collection getting Invalid document structure: Unknown attribute: "ids" which is not in the collection. Appreciate the...
