Search code examples
javascriptangularfirebasegoogle-cloud-firestoreangularfire2

Angularfire Document Referance collection


    return this.orderCollection.snapshotChanges().pipe(
      map(actions =>
        actions.map(a => {
          const data = a.payload.doc.data() as Order;
          const id = a.payload.doc.id;
          return { id, ...data };
        })
      )
    );
  }

enter image description here

Now How can I get Document referance Data in angularfire2?


Solution

  • You will need to load the referenced document separately. So something like:

    customerRef = a.payload.doc.get("customerId");
    customerRef.get().then((doc) => {
      console.log(doc.data());
    })