firestore get document with his children

Viewed 3520

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}
  }}
1 Answers

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.

Related