本文档不存在,不会显示在查询或快照中,但具有相同结构的文档工作 [英] This document does not exist and will not appear in queries or snapshots, but identically structured document works
问题描述
前言:这个问题已经被问到
c> territories / 6 不是作为实际的文件存在,而是 territories / 7
没有。
在Cloud Firestore中,可以拥有虚拟文档所拥有的子集合 - 即不存在较高级别的文档,但具有子元素。
这些虚拟文件可以很容易地组织信息,而不必创建重复的虚拟文件。
在这种情况下,您可以:
- 在
之前,在territories / 6
下创建了一堆发送文档, c $ c>地区文档或
- 您随后删除了
>地区/ 6
子收集文件。
- 您随后删除了
Preface: this question is already asked here but user gave up and gave solution to first answer. This question also differs in that I have two similar collection structures, but the error only occurs on one of them.
I am working with Google's new firestore database, and have created the following structure: territories/{list of territories}/dispatches/{list of dispatches}/{dispatch information}
We are using this method to create custom tokens on our backend using Firebase Admin SDK. When a user logs in on our backend, we generate the token and add the territories they have access to as additional claims, which we intend to access from the auth / request.auth objects in our Security Rules to limit their access to the dispatch documents accordingly. I mention this in case we are going about the structure incorrectly, in which case please correct me as we are new to firestore.
The problem we are encountering is that one of the documents gives the warning: "This document does not exist and will not appear in queries or snapshots" (see image below). However, we have an identical document structure (document 7 in the image) that does not give this warning and does appear in queries and snapshots.
This is telling you that territories/6
does not exist as an actual document, whereas territories/7
does.
In Cloud Firestore it is possible to have subcollections owned by "virtual" documents - that is the document at the higher level doesn't exist, but it has children.
These virtual documents can be easy ways to organize information without have to create duplicate dummy documents.
In this case, you've either:
- Created a bunch of dispatch documents under
territories/6
before you created theterritories
document, or - You've subsequently deleted
territories/6
without deleting the subcollection documents.
这篇关于本文档不存在,不会显示在查询或快照中,但具有相同结构的文档工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!