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
TypeScript
let promise = databases.listDocuments(
"647ac763cf53edxxxx",
"647ac820ba38520xxxxx",
[
Query.orderDesc("age")
]
);
promise.then(function (response) {
console.log(response);
}, function (error) {
console.log(error);
});```
TL;DR
The user is getting a "Query is not defined" error when trying to retrieve documents using the Appwrite API. They have imported the necessary modules correctly. One possible solution to this error is to check if an index has been created for the "age" attribute in the database.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 429 rate limit on my appwrite de...
how to fix this issue ?
- type generation on same columns in table
is there way to prevent this ? or only need to update column name like table prefix?
- Unable to send verification email
Hi! I’m trying to access my project on Appwrite Cloud (fra.cloud.appwrite.io), but I keep getting this popup saying: “To continue using Appwrite Cloud, please...