【问题标题】:Firestore: How can I create a subcollection in Firestore without having to add a document alreadyFirestore:如何在 Firestore 中创建子集合而无需添加文档
【发布时间】:2019-02-07 14:42:00
【问题描述】:

我在 Android 上: 在 firestore 控制台中,我无需添加数据(例如文档)即可创建子集合,但我不知道如何使用 api 来完成。 例如

   db.collection(*colelctionName*)
            .document(*documentName*)
            .collection(*subCollectionName*)

不创建子集合,我需要添加:

.add(Object ...)

但这实际上在子集合中创建了一个文档。 我想知道是否以及如何创建(子)集合而不必已经将文档/数据添加到该集合。

【问题讨论】:

    标签: java android firebase google-cloud-firestore


    【解决方案1】:

    Firestore 中的集合仅在其中存在文档或子集合时才存在。无法创建完全空的集合。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-02-20
      • 1970-01-01
      • 2019-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-28
      • 2020-01-05
      相关资源
      最近更新 更多