
DocumentList response = await databases!.listDocuments( databaseId: "*********", collectionId: "********", queries: [ Query.equal("user_phone_no", phoneNo), Query.orderDesc('$createdAt'), ], ); $createdAt show error, how can I query this, any help

have you created an index?

yes, its format error, it show me red

No the problem is on Query.orderDesc('$createdAt')
I tried Query.orderDesc('${createdAt}')
flutter consider it as local variable but its from appwrite database ($id, $createdAt, $updatedAt) common fields

queries should be passed as an array

only flutter expert answer me pls queries: [
Query.equal("user_phone_no", phoneNo),
Query.orderDesc('$createdAt'),
],

$createdAt
shows red error, format error

what is the error you're getting. show screenshots

also, show your indexes

You need to escape the $ like:
Query.orderDesc('\$createdAt')

Thanks Steven

I spent hours on this syntax issue until I read your response. Thanks so much!

[SOLVED] Query $createdAt
Recommended threads
- Hola equipo de soporte,
Hola equipo de soporte, Estoy desarrollando una Function en Appwrite Cloud con Node.js 22 y el siguiente package.json: { "name": "upload-whitelist", "type"...
- Sites 30MB limit from GitHub
I’m deploying a site from github as Other type on the Hobby plan. It is actually a Flutter web app but it’s in a subdirectory with the root being an html landin...
- Google OAuth2 Login Gets Stuck in Redire...
I'm facing an issue with the Google OAuth2 login flow on my Flutter Android app using the Appwrite SDK. After a successful sign-in with Google, the browser ente...
