You mean to save other people's name and birthday?
Exactly 💯
Will such users be registered in the app or you add others that don't have an account associated?
Only the user that is adding the names and birthdays will have an account.
Okay, then you can use both methods. There's not any major difference, maybe if you're going t have the ability to share in a future all birthdays an user has or other users will search other users saved birthdays it could be more convenient having everything in one collection, but if everything will remain as is, there's not a "better" approach. As said, personally I prefer just having a collection for everything, but it's just a personal choice
I don't think there will not be a usecase where other users can search another users birthday list.
It's only that user that should/will be able to view their birthday lists.
The model looks feasible but I don't know how to go about it in appwrite
Method 1:
Create a collection for each user: collection ID = user ID
Method 2 (what I do most times):
Collection named birthdays Attribute called User ID: here you store creator ID
Then you fetch all documents with the User ID = current user ID
For method 1: Can I programmically create a collection?
For method 2. Does this mean that all users will be using the same birthday collections which will have an attribute for user_id which I will use to query/filter with to get all the birthdays that belong to that user?
Only with functions
But in method 2 you will need too functions
I think it's still possible to use Relationships, but it's still beta
https://medium.com/geekculture/appwrite-frequently-asked-questions-374ce81513fe?sk=58820ac7b3372fad404e822b79f9b849 then search for database design
I would go with method 2. That's what the article suggests. Using document level permissions, a user would only get their documents
Okay, thank you
So by setting permissions to access that doc to the user that created it, I am able to have numerous documents in the birthday collection but they can only be accessed by their creators.
This then leads me to another question, Can I programmatically set permissions when creating a doc?
Yes you can. By default, the creator will be given read, update, and delete, but you can pass whatever permissions you want. See https://appwrite.io/docs/permissions
Alright, thank you Steven. I will get back to you when I create the model and test it out.
Another question, is there a limit to the number of documents a collection can have?
I think it's 74TB of data
I've thought there was not any hard limits. What's happens if I reach 74TB (okay, better not to dream 😆)
It's mariadb max table size
I think that's enough for my projects and most 😅
Alright, thank you.
[Solved] Need help with creating database model
Recommended threads
- delete document problems
i don't know what's going on but i get an attribute "tournamentid" not found in the collection when i try to delet the document... but this is just the document...
- Attributes Confusion
```import 'package:appwrite/models.dart'; class OrdersModel { String id, email, name, phone, status, user_id, address; int discount, total, created_at; L...
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...