How to efficiently design Firebase database for Home service Booking application? [closed]

Posted on

Question :

I’m planning to build my own app. It’s a home service App to link users with other providers.
I’m recently used a NoSQL database, Firebase, and I am stuck with the design of the database for my app. The question is how to structure the databases in this way with NoSQL, like a JSON tree?

Like

{
"uID":"01",
"username":"John",
"Booking":[{
       "Bid":"01",
       "BDetails":"Cleaner Rooms",
       "Baddress":"America",
        "providerID":"023",
        "timestamp":"1-Mar-2019"
       ....
       ....
      }]
}

Is that right?

Answer :

your database should look something like this object:

{
  users : { uid, ... },
  bookings: { id, uid, ... },
}

And you access each user’s bookings by querying with a condition that the column uid matches the user’s id, by using firebase.auth().currentUser if you’re using firebase. btw you should Cloud Firestore for better scalability and faster queries.

Leave a Reply

Your email address will not be published.