
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
- Redirect URL sends HTTP instead of HTTPS...
I am not sure since when this issue is present, but my Google and Apple redirect URI are no longer pointing to the HTTPS redirect URI when I try to use OAuth. ...
- Failing to run document operations on sd...
Could someone point me in the right direction I'm going in cirlces. I have a problem with sdks and my self-hosted server in production (for ~3 years) I have bee...
- Functions fail to deploy after switching...
Hi <@1087889306208718959> , after switching my self-hosted Appwrite instance to use AWS S3 as the storage backend, my Cloud Functions stopped working. I’m runni...
