Hmm. So how do you query this? Say you want to get a list of chats a user has
Haven't considered that. Yeah then you can save it
In the last chat app I built with Realm, each chat object had a "participantsIDs" attribute. That way I could easily get a user's chats by querying the attribute using contains
But all in all, thanks for your help. I learnt a thing or two
I'd also like to know if there's a limit on the documents a collection could possibly hold
There is not really a limit
Alright.
Thank you
And even if there would be one it wake take a long time for you to reach it lmao
I literally inserted over 50m documents to a collection to test its effiency
It all still works fine
Oh wow.
Alright thanks for the info.
I was wondering if to keep all the messages in a single collection or create a separate collection for each chat as you earlier mentioned
I would recommend separate collection for each chat
Otherwise you would have to include a chatId to the message model as well
Yes, this.
In the first approach you only store the chatId once somewhere
I'm just tryna avoid having to write more cloud functions 😅
but if each message contains chatId that can add up quite quickly
True this.
I'll do this anyways. Seems a lot cleaner
Yeah and I think permissions are somewhat easier to maintain I think
Yeah. Thank you 🙏🏽
For image attachments you could create a function: Everytime a user uploads an image to a bucket where the chatId act as bucketId, a function gets triggered an creates a document in the chat collection with
message: <fileId> type: image senderId: <userId of sender>
Recommended threads
- Cant configure email templates
i configure it on the console, and when i send the OTP, it sends with appwrite's email (instead of custom smtp) and with the branding, but i have the Pro (educa...
- Need help with createExecution function
Hi, Need some help understanding createExecution. When requesting function execution via createExecution, the function handler arguments are incorrect and rese...
- Need Help with Google OAuth2 in Expo usi...
I'm learning React Native with Expo and trying to set up Google OAuth2 with Appwrite. I couldn't find any good docs or tutorials for this and my own attempt did...