Mahmoud Niypoo
Mahmoud Niypoo

Reputation: 1710

firestore get document with his children

I have a users collection every user has a sub collection called "settings" and "settings" have documents like ids "option1","option2"

return this.fireStore.doc(`users/${user.uid}`).valueChanges()

so I need to get also a user settings with all documents options like

  userA =  {
    username:'name',
    email:'email@email',
    settings:{
    option1 :{data},
    option2 :{data}
  }}

Upvotes: 2

Views: 4089

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 598708

There is no API in Firestore to get documents from multiple collections in one go. You will have to use two separate calls: one for the main user document, and one for all documents in the settings subcollection.

Upvotes: 3

Related Questions