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...
    📕📕📕📕📕
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 49

  • @Qoor1994
    @Qoor1994 หลายเดือนก่อน

    Thank you for sharing your knowledge!

    • @dbestech
      @dbestech  หลายเดือนก่อน

      My pleasure!

  • @abdallamowlid7762
    @abdallamowlid7762 ปีที่แล้ว +1

    Keep going brother

    • @dbestech
      @dbestech  ปีที่แล้ว

      Thank you, I will

  • @imyogisingh
    @imyogisingh ปีที่แล้ว

    thank you sir ! this will help us a lot ☺

    • @dbestech
      @dbestech  ปีที่แล้ว

      Most welcome 😊

  • @user-kb3dd3nb6k
    @user-kb3dd3nb6k ปีที่แล้ว

    Hello. Tell me what the theme in yours IDE. Thank you.

  • @peshawaamin3083
    @peshawaamin3083 ปีที่แล้ว

    ❤️❤️

  • @emranimam92
    @emranimam92 ปีที่แล้ว +2

    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
      @dbestech  ปีที่แล้ว +1

      actually when I update, I do update based on id, nothing else

    • @emranimam92
      @emranimam92 ปีที่แล้ว

      @@dbestech is it a better design? If you have more collection then you have to update those too.

    • @dbestech
      @dbestech  ปีที่แล้ว

      @@emranimam92 well, in this app I don’t have. It’s this app’s perspective

    • @emranimam92
      @emranimam92 ปีที่แล้ว

      @@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.

    • @anazi
      @anazi 4 หลายเดือนก่อน

      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.

  • @brainiactech7139
    @brainiactech7139 ปีที่แล้ว

    I love your videos bro.
    Do the video from the beginning pls😭

    • @dbestech
      @dbestech  ปีที่แล้ว

      th-cam.com/video/F2xtrS3xSLo/w-d-xo.html here we go

  • @zakariyedaauud5527
    @zakariyedaauud5527 ปีที่แล้ว

    Thank sir

    • @dbestech
      @dbestech  ปีที่แล้ว

      You are welcome

  • @probelens1842
    @probelens1842 ปีที่แล้ว

    This is really amazing I wish you could explain how you did it via code

    • @dbestech
      @dbestech  ปีที่แล้ว +2

      th-cam.com/video/F2xtrS3xSLo/w-d-xo.html this is the complete tutorial

  • @user-sb9hb2bb7o
    @user-sb9hb2bb7o ปีที่แล้ว +1

    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!

    • @bobbynwm
      @bobbynwm 9 หลายเดือนก่อน

      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

    • @adscript4713
      @adscript4713 5 หลายเดือนก่อน

      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.

    • @Qoor1994
      @Qoor1994 หลายเดือนก่อน

      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.

  • @wilsontoussile519
    @wilsontoussile519 ปีที่แล้ว

    Hello and 🙏.
    User id seems to differ from user uid. How to get that id. It that id unic?

    • @dbestech
      @dbestech  ปีที่แล้ว +1

      Can you tell me the time line? we are using id as uid if you see the database structure

  • @annieincarnated
    @annieincarnated 12 วันที่ผ่านมา

    So helpful

    • @dbestech
      @dbestech  12 วันที่ผ่านมา

      Glad you think so!

    • @annieincarnated
      @annieincarnated 11 วันที่ผ่านมา

      @@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.

    • @dbestech
      @dbestech  11 วันที่ผ่านมา

      @@annieincarnated you may leave any questions here. I will reply. But if you want to have meeting, we charge 50 usd per hour.

    • @annieincarnated
      @annieincarnated 11 วันที่ผ่านมา

      @@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.

  • @paininmydroid4526
    @paininmydroid4526 3 หลายเดือนก่อน

    Wa Alaykum Salaam Wa Rahmatulahi Wa barakatuhu.

    • @dbestech
      @dbestech  2 หลายเดือนก่อน

      like and share

  • @MaTlaBAdda
    @MaTlaBAdda 2 หลายเดือนก่อน

    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?

    • @dbestech
      @dbestech  2 หลายเดือนก่อน

      firestore auto updates new messages. You don't need to search anything. You need to use StreamBuilder in the frontend

    • @MaTlaBAdda
      @MaTlaBAdda 2 หลายเดือนก่อน

      @@dbestech I found a better way to create a chatroom between two users, without any extra read and write operations in the cloud firestore

  • @deepeshv.p4179
    @deepeshv.p4179 ปีที่แล้ว +1

    Sir plz give ur github link

    • @Qoor1994
      @Qoor1994 หลายเดือนก่อน

      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.

  • @mariyananjelo2948
    @mariyananjelo2948 ปีที่แล้ว

    Where is the coding?

  • @MaTlaBAdda
    @MaTlaBAdda 2 หลายเดือนก่อน

    bhai github ka link bhi daal dete, garibo ki madad ho jati

    • @dbestech
      @dbestech  2 หลายเดือนก่อน

      Brother, I don't speak hindi

    • @MaTlaBAdda
      @MaTlaBAdda 2 หลายเดือนก่อน

      @@dbestech I am saying, please insert github link for the code, it would be helpful

  • @OmranMosa
    @OmranMosa 6 หลายเดือนก่อน

    source code

    • @dbestech
      @dbestech  6 หลายเดือนก่อน

      You may consider buying the source code which will help you and me more

  • @OmranMosa
    @OmranMosa 6 หลายเดือนก่อน

    source code 😮

    • @dbestech
      @dbestech  6 หลายเดือนก่อน

      You may consider buying the source and get free access to the course.

    • @OmranMosa
      @OmranMosa 6 หลายเดือนก่อน

      @@dbestech Resolved for free 😆
      thank u