Javascript _firebase\u网页包\u导入的\u模块\u 10\u.usersCollection.doc(…).collectionGroup不是函数
我有一个问题,比如标题。当我想用collectionGroup下载我的“蜂箱”时,会弹出这个错误,我不知道该怎么做才能使它正常工作 我的代码是:Javascript _firebase\u网页包\u导入的\u模块\u 10\u.usersCollection.doc(…).collectionGroup不是函数,javascript,vue.js,google-cloud-firestore,Javascript,Vue.js,Google Cloud Firestore,我有一个问题,比如标题。当我想用collectionGroup下载我的“蜂箱”时,会弹出这个错误,我不知道该怎么做才能使它正常工作 我的代码是: async getHives() { await fb.usersCollection .doc(fb.auth.currentUser.uid) .collectionGroup('hives') .onSnapshot(snap
async getHives() {
await fb.usersCollection
.doc(fb.auth.currentUser.uid)
.collectionGroup('hives')
.onSnapshot(snapshot => {
let hivesArray = [];
snapshot.forEach(doc => {
let hive = doc.data();
hive.id = doc.id;
hivesArray.push(hive);
});
store.commit('setHives', hivesArray);
});
},
集合组查询不能包含在特定文档中-没有用于该查询的API。它只能在整个数据库中执行:
firebase.firestore().collectionGroup("hives")
如果您想过滤所有这些文档以只接收某些文档,那么您可以像任何其他查询一样进行过滤
firebase.firestore().collectionGroup("hives")
.where("someField", "==", true)
在堆栈溢出时,不要发布文本图像。将文本复制到问题中并格式化,以便阅读、复制和搜索。