【问题标题】:Reading Data from a document after checking if its subcollection's document is correct在检查其子集合的文档是否正确后从文档中读取数据
【发布时间】:2020-11-09 18:37:27
【问题描述】:

正如您在提供的图片中看到的,我的数据库结构如下。

Group => contains all groups
Test A => one of the groups
Sessions => contains all the sessions dates and timings of that particular group
date => document is titled by the date of that session

我正在尝试阅读今天有会议的小组文档。这可能吗?即使这是一个多步骤的过程,我该怎么做? 为简化起见,我正在尝试阅读组文档,其中存在标题为今天的日期在其子集合“会话”中的文档。如果不存在这样的文档,则可以跳过它。

【问题讨论】:

    标签: javascript reactjs firebase react-native google-cloud-firestore


    【解决方案1】:

    您尝试做的事情不能在一个查询中完成。

    你可以:

    1. 使用组名和格式化日期构建对会话文档的 DocumentReference。
    2. get() 文档。如果存在:
      1. 为组文档构建另一个 DocumentReference
      2. 阅读

    【讨论】:

      猜你喜欢
      • 2019-01-08
      • 2019-04-19
      • 2020-08-15
      • 1970-01-01
      • 1970-01-01
      • 2018-12-22
      • 1970-01-01
      • 2022-10-19
      • 2021-07-20
      相关资源
      最近更新 更多