How to Design Firebase Collection and Documents for Chat App
ฝัง
- เผยแพร่เมื่อ 9 ม.ค. 2023
- How to Design Firebase Collection and Documents for Chat App
Flutter Chat App Udemy Course
www.udemy.com/course/flutter-...
📕📕📕Learn about our excellent course
Flutter Multi Vendor App
www.dbestech.com/tutorials/fl...
Flutter Single Vendor App
www.dbestech.com/tutorials/fl...
📕📕📕📕📕 - วิทยาศาสตร์และเทคโนโลยี
Thank you for sharing your knowledge!
My pleasure!
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.
❤️❤️
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.
I love your videos bro.
Do the video from the beginning pls😭
th-cam.com/video/F2xtrS3xSLo/w-d-xo.html here we go
Thank sir
You are welcome
This is really amazing I wish you could explain how you did it via code
th-cam.com/video/F2xtrS3xSLo/w-d-xo.html this is the complete tutorial
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.
These two guys above are missing the points. I do not see why he used a separate user ID where he could use the document ID as a user ID. I would personally use document ID as a user ID.
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
So helpful
Glad you think so!
@@dbestech is there a way to contact you? I have a small thing on firebase I am stuck with but can't find a solution on the docs or youtube.
@@annieincarnated you may leave any questions here. I will reply. But if you want to have meeting, we charge 50 usd per hour.
@@dbestech not a meeting, don't know how exactly to explain it. A screenshot with the actual description would be easier so you could see the error it shows. I think I have the set up correctly ut the bug keeps telling me there is still a problem. So I am not sure if it is a problem or mistake I made or if it might be a synchronisation problem that is coming from either firebase or the platform I am using. I did put the screenshot on GIT and the community from the platform for like a week now and nobody replied.
Wa Alaykum Salaam Wa Rahmatulahi Wa barakatuhu.
like and share
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
Sir plz give ur github link
This video is clearly about learning about the database model not having a source code. I would prefer learn a concept from this video and do it on your own rather than just copying and pasting.
Where is the coding?
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
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