【发布时间】:2021-11-26 10:40:09
【问题描述】:
我不认为我离答案很远,我试图在 Firestore 上的一个数组中查询一个 id。
我想比较参与者的id。
还有我在 Firestore 中的数据库:
还有我的函数,目前我的函数返回 size =0,所以他们无法捕获查询。
const deleteAbuse = (type) => {
const participants = channel?.otherParticipants;
if (!participants || participants.length != 1) {
return;
}
const myID = currentUser.id;
const otherUserID = participants[0].id;
console.log('id user', otherUserID);
channelDB
.where('participants.id', '==', otherUserID)
.get()
.then((querySnapshot) => {
console.log(querySnapshot.size);
querySnapshot.forEach((doc) => {
console.log(doc.ref);
//doc.ref.delete();
});
});
};
【问题讨论】:
标签: javascript firebase react-native google-cloud-firestore