While storing and structuring data inside Firebase we have to think twice about how we will be fetching the data for the application. This problem is the same as when we use any other NOSQL database such as MongoDB. We should prefer flattening data rather than nesting everything and while fetching the data we have to join the flattened data.
Let's take the example of a blogging website where users create blog posts and all blog posts have comments. So, rather than nesting data in Firebase we prefer to divide it:
"users": { "user1": { "name": "John Smith", "type": "editor" "blogs": { "post1": { "id": 123456 "title": "welcome of ionic", "post": "Ionic is opensource SDK or hybrid apps" }, "post2": { ...