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
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- apple exchange code to token
hello guys, im new here 🙂 I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...