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

dba.stackexchange https://dba.stackexchange.com/questions/231061

  •  23-01-2021
  •  | 
  •  

Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a dba.stackexchange
scroll top