i am using flutter sdk (appwrite: ^8.2.2) and cloud appwrite. When i am try to query getting an error -: Index not found: user_id
user_id is the attribute in my db.
My code is below
await databases.listDocuments( databaseId: AppWriteConstants.databaseId, collectionId: AppWriteConstants.colProjectUserRole, queries: [ Query.equal('user_id', prefs.getString(PreferenceType.userId) ?? ''), ], )
You must create an index of your attribute in order to use it in a query.
Ref: https://appwrite.io/docs/databases#indexes Also see this post by VicentGe https://dev.to/appwrite/how-do-i-index-my-appwrite-collection-2o4n
Thank you @Ponguta_ . It solve the issue.
Recommended threads
- [SOLVED] curl error Number: 6 — function...
Hello, I invested a lot of time in this error in a fresh install of appwrite 1.8.1 and lasted until fix, this if for helping anyone that can have the same weird...
- createCollection Deprecated
- All My Project is Gone
Hello everyone, please help. Why have all my projects suddenly disappeared? I received a warning via email about one of my projects being paused. When I clicked...