首页 > 解决方案 > 在firestore中监听多个文档,它的ids存储在一个数组中

问题描述

我正在使用 Firestore 为电子商务构建一个购物车。下载购物车文档,并将产品 ID 存储在数组中。现在我想听这些产品文档的价格、数量等数据变化。

我的firestore数据库设计如下。

-ProductCollection
   -{product_id}
       document
       |-name
       |-price
       |-availableSizes
       |    -1
       |      -name
       |      -quantityAvailable
       |    -2
       |      -name
       |      -quantityAvailable
-CartCollection
   -{cart_id}
     document
      |-ItemList
      |   -{product_id}
      |      -size
      |         -quntityNeeded
      |      -size
      |         -quntityNeeded
      |   -{product_id}
      |      -size
      |         -quntityNeeded
      |      -size
      |         -quntityNeeded

标签: androidfirebasegoogle-cloud-firestore

解决方案


推荐阅读