How can I know what is the best database structure for my app?

26 views
Skip to first unread message

Mohammed Ennabah

unread,
Dec 2, 2016, 1:36:18 PM12/2/16
to Firebase Google Group
Hello all,


I'm building a chat app for sake of learning, and I'm using Firebase database to deliver messages. But I'm confused with what structure to build and use.

Thank you for reading and trying to help.

Alex Memering

unread,
Dec 2, 2016, 2:56:34 PM12/2/16
to fireba...@googlegroups.com
The basic idea is that you should make reading the data that you need to display as easy and fast as possible.  Try to find a structure where performing one or a small handful of reads will get you all of the info you need to show your end-user the info for that particular screen.  This may require you to "work hard" when you are writing new data though, and this is okay.  Sometimes it is best to duplicate the data you are writing in several locations so that you don't need to perform multiple reads, this can easily be accomplished in a single write using a deep update.

As a side note you may want to check out the Friendly Chat codelab.  This goes over the basics of creating a chat app using Firebase.  The one I linked to is the Web example but there are also ones for Android, Objc, and Swift.

Hope this helps,
Alex

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/8f75f225-697d-4169-9d9f-7ab42e02f7d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages