[英]Firestore returning no records yet, I see them in console
from my app and javascript console 从我的应用程序和javascript控制台
firestore.collection('organizations/f1f4002a-1fb2-4805-baf1-a1a709f228e9/emailsSent').get().then(console.log)
returns QuerySnapshot with empty: true 返回QuerySnapshot为空:true
yet there IS clearly one record. 但显然有一个记录。 Every other query I write seems to work.
我写的所有其他查询似乎都可以工作。 ie assignmentLogs, emails, etc.
也就是说,assignLogs,电子邮件等。
``` ```
I feel like I'm going crazy and it's probably something really stupid so I apologize in advance. 我觉得我快疯了,这可能真的很愚蠢,所以我提前道歉。
Notice that the document name 455...2c2
is shown in italics in the console, which definitely not the normal case for documents displayed in the console. 请注意,文档名称
455...2c2
在控制台中以斜体显示,对于控制台中显示的文档,这绝对不是正常情况。 That italics actually means that the document was deleted, however, it probably contains other subcollections that were not deleted (try clicking into it). 斜体实际上表示该文档已删除,但是,它可能包含其他未删除的子集合(尝试单击它)。
Since Firestore queries are shallow, the get() you're trying to perform is not going to yield any documents, because there are not actually any documents in that collection. 由于Firestore查询很浅,因此您尝试执行的get()不会产生任何文档,因为该集合中实际上没有任何文档。
Something in your system may have deleted that document and not deleted its subcollections, so it's probably worthwhile to figure out what's responsible for that delete, and modify it so that it deletes its subcollections as well (otherwise they will remain "orphaned" in your database like this indefinitely). 您系统中的某些内容可能已经删除了该文档,但并未删除其子集合,因此可能值得找出造成该删除的原因并进行修改,以便它也删除其子集合(否则它们将在数据库中保持“孤立”状态)无限期地这样)。
Meanwhere, there's nothing much you can do about your query as shown - it's returning the correct results. 意思是说,对于如图所示的查询,您无能为力,它可以返回正确的结果。
Try this... 尝试这个...
const db = admin.firestore();
return db.collection('organizations/f1f4002a-1fb2-4805-baf1-a1a709f228e9/emailsSent').get().then(snapshot => {
snapshot.forEach (doc => {
console.log(`ID: ${doc.id}`);
console.log(doc.data());
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.