Good video! 👍 One issue with the fields in your message collection, you set from_name, from_picture, to_name etc. but if the user update those information you have to update your whole message collection when those values changes. You could only set just the id and query user to retrieve those informations.
@@dbestech yeah its fine for just a simple chat app but faced this issue myself in a big app. Wish Firestore was relational rather than just collection and sub collections system.
Actually in firebase you charged by updating a document only, even if the document is in a large collection with million other document. Also for a document that contains sub-collections they are not affected by the parent document updates. Yes with each message you send you are charged by "adding a document" + updating fields in a document. Two writes to the database. Which is normal in Firestore and any NoSQL db. This structure can be enhanced with "read, unread, received" properties to both the main document (AKA chat) and each message can have an indicator as well. But notice that you will be updating two documents again when user opens the unread message.
To add to what bobbynwn said, simply put you need a way to distinguish one user from another when creating and retrieving chat messages. Using the Document ID generated for each message wouldn't work as it's not associated with a particular user and needs to be unique.
but how does the receiver will know, that it has received a message, you will have to search in all the documents in message collection, don't you think, that is cumbersome?
Good video! 👍
One issue with the fields in your message collection, you set from_name, from_picture, to_name etc. but if the user update those information you have to update your whole message collection when those values changes. You could only set just the id and query user to retrieve those informations.
actually when I update, I do update based on id, nothing else
@@dbestech is it a better design? If you have more collection then you have to update those too.
@@emranimam92 well, in this app I don’t have. It’s this app’s perspective
@@dbestech yeah its fine for just a simple chat app but faced this issue myself in a big app.
Wish Firestore was relational rather than just collection and sub collections system.
Actually in firebase you charged by updating a document only, even if the document is in a large collection with million other document. Also for a document that contains sub-collections they are not affected by the parent document updates. Yes with each message you send you are charged by "adding a document" + updating fields in a document. Two writes to the database. Which is normal in Firestore and any NoSQL db.
This structure can be enhanced with "read, unread, received" properties to both the main document (AKA chat) and each message can have an indicator as well. But notice that you will be updating two documents again when user opens the unread message.
Keep going brother
Thank you, I will
thank you sir ! this will help us a lot ☺
Most welcome 😊
Hello. Tell me what the theme in yours IDE. Thank you.
This is really amazing I wish you could explain how you did it via code
ruclips.net/video/F2xtrS3xSLo/видео.html this is the complete tutorial
I love your videos bro.
Do the video from the beginning pls😭
ruclips.net/video/F2xtrS3xSLo/видео.html here we go
Hello Sir, thanks for the video. @ 1:38: Why do you have an id in the user document? Could you not just use the document id as the user id? Thank you!
that is for message alignment - if that uid belongs to the logged in user then it the chat bubbles sit on the right, otherwise on the left
To add to what bobbynwn said, simply put you need a way to distinguish one user from another when creating and retrieving chat messages. Using the Document ID generated for each message wouldn't work as it's not associated with a particular user and needs to be unique.
❤️❤️
Thank sir
You are welcome
Hello and 🙏.
User id seems to differ from user uid. How to get that id. It that id unic?
Can you tell me the time line? we are using id as uid if you see the database structure
but how does the receiver will know, that it has received a message, you will have to search in all the documents in message collection, don't you think, that is cumbersome?
firestore auto updates new messages. You don't need to search anything. You need to use StreamBuilder in the frontend
@@dbestech I found a better way to create a chatroom between two users, without any extra read and write operations in the cloud firestore
Wa Alaykum Salaam Wa Rahmatulahi Wa barakatuhu.
like and share
Sir plz give ur github link
bhai github ka link bhi daal dete, garibo ki madad ho jati
Brother, I don't speak hindi
@@dbestech I am saying, please insert github link for the code, it would be helpful
Where is the coding?
source code
You may consider buying the source code which will help you and me more
source code 😮
You may consider buying the source and get free access to the course.
@@dbestech Resolved for free 😆
thank u