Let's say you have the following structure:
shopping-carts (collection)
- shopping-cart 1(doc)
-- dateCreated (field)
-- items (collection)
- shopping-cart 2(doc
-- dateCreated
-- items
.
.
.
So, how would we go about getting the entire shopping-cart(doc) as an ShoppingCart object that we defined as
export interface ShoppingCart {
items: ShoppingCartItem[]
dateCreated: string
}
afs.doc('shopping-cart/id').valueChanges() only returns the dateCreated
afs.doc('shopping-cart/id').collection('items').valueChanges() returns the items.
Easy way to get all in one and create it as an object?