Firestore无法检索完整的数据值 [英] Firestore is not retrieving the complete data values

查看:47
本文介绍了Firestore无法检索完整的数据值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

图1显示了我的数据库的层次结构.

Image 1 shows the hierarchy of my DB.

我正在尝试检索课程的名称[Android,Branding ....].斜体(品牌,其他)中的数据由后端添加-发布命令,而其他数据则通过键入添加.如屏幕快照2所示,仅检索非斜体数据时,我无法弄清楚为什么会发生这种情况.屏幕截图2还显示了我正在使用的查询.请帮忙!!

I am trying to retrieve the names of the courses [Android, Branding .... ]. The data in italics(Branding, others) gets added by the backend - post commands, and the other data is added typing. While retrieving only the non - italics data gets retrieved as seen in screenshot 2. I can not figure out why this might be happening. Screenshot 2 also shows the query I am using to the same. Please help !!

谢谢.

推荐答案

如屏幕截图2所示,仅检索非斜体数据时,

While retrieving only the non - italics data gets retrieved as seen in the screenshot 2

以斜体显示的文档ID-表示实际上没有文档在其位置;但是,有些子集合在其下组织有文档.Firestore查询仅返回非空文档.

Document IDs shown in italics - means there is not actually a document in its place; however, there are subcollections with documents organized underneath them. Firestore query returns only non-empty documents.

您可以选择两种选择,

  • 如果您确定自己的文档ID,可以直接访问集合
firestore.collection('users/groups/groupID/courses/others/courses').get()

  • 使用 collectionGroup 查询;但似乎您有许多具有相同ID courses 的收藏集,因此它可能会使所有内容恢复原状,可能不适合您!我建议您阅读 firabase文档这是局限性
    • Using collectionGroup queries; but it seems you have many collections with same ID courses, so it might retreive all and might not be suitable for you! I recommend you to read firabase doc for it's limitations
    • firestore.collectionGroup('courses').get()
      

      这篇关于Firestore无法检索完整的数据值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆