【发布时间】:2021-11-14 12:35:41
【问题描述】:
我在 Firestore 数据库中有一组文档。所有文件都有一个名为“debtorEmail”的字段,但只有一些文件还有一个名为“creditorEmail”的字段。我想阅读所有没有“creditorEmail”的文件。根据 Firestore documentation:
const notCapitalQuery = query(citiesRef, where("capital", "!=", false));
此查询不返回不存在首都字段的城市文档。不等于 (!=) 和 not-in 查询会排除给定字段不存在的文档。
我的代码如下:
const docCollection = collection(db, "requests");
const dataSection = document.getElementById("data-section");
const qRequests = query(docCollection, where("creditorEmail", "!=", false));
但是这个查询准确地传递了存在 creditorEmail 的那些文档。如果我将“false”更改为“true”,则查询会提供相同的结果。好像“!=”条件不起作用。有人知道出了什么问题吗?
【问题讨论】:
标签: javascript google-cloud-firestore