
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
- I am facing this error: type 'Null' is ...
When attempting to fetch areas from the area collection, the application throws an error: "type 'Null' is not a subtype of type 'int.'" This issue originates in...
- Adding Domain to Sites [Self Hosted]
I am struggling to get this working. I stood-up a new server and deployed appwrite 1.7.4. I added update .env file _APP_DOMAIN=appwrite.mydomain.com _APP_DOMAI...
- Cloud DB
Hey guys, my entire database has gone missing. Project id 665ae18f002aac268b73
