How to Design Firebase Collection and Documents for Chat App

Поделиться
HTML-код
  • Опубликовано: 9 янв 2023
  • How to Design Firebase Collection and Documents for Chat App
    Flutter Chat App Udemy Course
    www.udemy.com/course/flutter-...
  • НаукаНаука

Комментарии • 38

  • @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 2 месяца назад

      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.

  • @abdallamowlid7762
    @abdallamowlid7762 Год назад +1

    Keep going brother

  • @imyogisingh
    @imyogisingh Год назад

    thank you sir ! this will help us a lot ☺

  • @user-kb3dd3nb6k
    @user-kb3dd3nb6k Год назад

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

  • @probelens1842
    @probelens1842 Год назад

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

    • @dbestech
      @dbestech  Год назад +2

      ruclips.net/video/F2xtrS3xSLo/видео.html this is the complete tutorial

  • @brainiactech7139
    @brainiactech7139 Год назад

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

    • @dbestech
      @dbestech  Год назад

      ruclips.net/video/F2xtrS3xSLo/видео.html here we go

  • @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 7 месяцев назад

      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 3 месяца назад

      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.

  • @peshawaamin3083
    @peshawaamin3083 Год назад

    ❤️❤️

  • @zakariyedaauud5527
    @zakariyedaauud5527 Год назад

    Thank sir

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

  • @MaTlaBAdda
    @MaTlaBAdda 26 дней назад

    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  26 дней назад

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

    • @MaTlaBAdda
      @MaTlaBAdda 25 дней назад

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

  • @paininmydroid4526
    @paininmydroid4526 Месяц назад

    Wa Alaykum Salaam Wa Rahmatulahi Wa barakatuhu.

  • @deepeshv.p4179
    @deepeshv.p4179 Год назад +1

    Sir plz give ur github link

  • @MaTlaBAdda
    @MaTlaBAdda 26 дней назад

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

    • @dbestech
      @dbestech  26 дней назад

      Brother, I don't speak hindi

    • @MaTlaBAdda
      @MaTlaBAdda 25 дней назад

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

  • @mariyananjelo2948
    @mariyananjelo2948 Год назад

    Where is the coding?

  • @OmranMosa
    @OmranMosa 4 месяца назад

    source code

    • @dbestech
      @dbestech  4 месяца назад

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

  • @OmranMosa
    @OmranMosa 4 месяца назад

    source code 😮

    • @dbestech
      @dbestech  4 месяца назад

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

    • @OmranMosa
      @OmranMosa 4 месяца назад

      @@dbestech Resolved for free 😆
      thank u