【发布时间】:2018-04-02 13:42:20
【问题描述】:
假设您有以下结构:
shopping-carts (collection)
- shopping-cart 1(doc)
-- dateCreated (field)
-- items (collection)
- shopping-cart 2(doc
-- dateCreated
-- items
.
.
.
那么,我们如何将整个购物车(doc)作为我们定义为的 ShoppingCart 对象来获取
export interface ShoppingCart {
items: ShoppingCartItem[]
dateCreated: string
}
afs.doc('shopping-cart/id').valueChanges() 只返回创建日期
afs.doc('shopping-cart/id').collection('items').valueChanges() 返回项目。
将所有内容合二为一并将其创建为对象的简单方法?
【问题讨论】:
标签: angular firebase angularfire2 google-cloud-firestore