使用VueJS和Firebase检索和过滤子集合

时间:2019-08-23 07:32:32

标签: javascript firebase vue.js google-cloud-firestore

我正在尝试使用Cloud Firestore中的VueJ从子集中检索和过滤数据。通过

,输出效果很好
db.collection('deliveryservice').doc('0GKIOX8LHdUpxo0ZQrsY').collection('product')
  .get().then(querySnapshot => {
              querySnapshot.forEach(doc => { 

我尝试使用.where语句过滤产品,但没有成功。控制台说

  

a.collection(...)。doc(...)。哪里不是函数

我尝试的代码是

db.collection('deliveryservice').doc('0GKIOX8LHdUpxo0ZQrsY').collection('product')
  .where('product_id', '==', to.params.product_id)
            .get().then(querySnapshot => {
                querySnapshot.forEach(doc => {

0 个答案:

没有答案