Is there any way to add indexes on database documents when we createDocument.
I'm trying to understand your use case to suggest a good approach.
So indexes are created for a Collection., using the Attributes of that collection.
So one Collection/table can have as many indexes as you want, but I don't see how creating a new document would be useful for adding an index. Help me out in understanding what you're trying to do lol
I have multiple documents on a collections which is created by the users, so one user can save max 3 files ( the user attribute have the user id ), now if a user needs their saved data, instead of fetch all docs I want fetch only those docs which is matched with user id.
You typically create the indexes beforehand just like you create the attributes before using the collection 🧐
Steven, Can you please explain how I need to write the code?
My database is like this: In a collection, all users can save max 3 files with their auth id, now I want to fetch the 3 specific files which that user created by his or her Id instead of all the files.
im thinking if you can do this without having to create seperate indexes for each user
just create an index for the userId attribute in the collection, and query to return the ones that match the input userId
Yeah it doesn't make sense to create an index for each user. Based on how many users you're expecting, you can end up creating thousands of indexes which I dont think is a good idea
It make sense 100%
is their any way to create index throw code just like attribute?
Thanks for the link, Steven 👍
Recommended threads
- I can't UNPAUSE my project with the free...
I received an email notifying me that my project had been paused due to inactivity, and the email included a link to "Restore project." However, that button red...
- How to bypass the rate limit on the back...
Once a month my app has a ton of usage and I always run into the Too many requests 429 error. I am trying to optimize the queues and jobs to manage that, but a...
- 401 - Project not accessible in this reg...
Hi Appwrite team, I’m experiencing a Cloud Console issue with my NYC region project. Problem: - Some Console pages return: “401 - Project is not accessible ...