简体   繁体   English

Firestore还没有返回任何记录,我在控制台中看到了它们

[英]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,电子邮件等。

``` ```

Firebase控制台

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.

相关问题 使用window.onerror捕获错误但在控制台上看到错误 - Catch errors with window.onerror yet see errors on console 如何打印我在控制台中看到的 Firebase 数组元素,以在网页上显示它们? - How can I print the Firebase array elements that I see in the console, to display them on the webpage? Blob 图像不会显示在 UI 中,尽管我可以在控制台上看到它们 - Blob images does not show up at UI, although I can see them on console Backbone.js model.get()返回'undefined',即使我可以在console.log中看到属性 - Backbone.js model.get() returning 'undefined' even though I can see the attributes in console.log javascript返回一个对象,但不是我期望看到的 - javascript returning an object but not what I expected to see 我想在 javascript 中的控制台中显示匹配的记录 - i want to display the matching records in the console in javascript Firestore 安全规则 - 缺少权限或权限不足,但我已编写 - Firestore Security Rules - Missing or insufficient permission, but I have written them 如何限制FireBase firestore get()方法返回的记录? - How do I limit records returned by FireBase firestore get() method? 我正在传递道具,但我看不到它们 - I am passing in props but i cant see them firestore 1.0未返回Firestore时间戳 - firestore 1.0 not returning Firestore timestamp
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM