【问题标题】:Firebase cloudstore get all collections in document in flutter [duplicate]Firebase cloudstore在flutter中获取文档中的所有集合[重复]
【发布时间】:2021-06-01 13:01:53
【问题描述】:

我将获取文档中的所有集合 当我不知道集合的名称时,如何获取文档中的所有集合

await FirebaseFirestore.instance
    .collection('answers')
    .doc('vS55vOUPtNXaRY06IXIPq6V9ss73')
    .collection('uu')
    .get()
    .then((querySnapshot) {      

}).catchError((e){

});

文档“vS55vOUPtNXaRY06IXIPq6V9ss73”有 2 个集合,“uu”和“uy”。这是动态的。

【问题讨论】:

  • 无法通过 Firestore 的客户端 SDK 获取集合列表。您必须已经知道代码中的集合名称,或者将它们存储在其他地方(例如在父文档的数组字段中)。
  • 看看下面的article

标签: firebase flutter google-cloud-firestore


【解决方案1】:

Firestore.instance.collection("answers").snapshots这可以用来检索firestore中的所有文档

【讨论】:

    猜你喜欢
    • 2021-01-06
    • 1970-01-01
    • 1970-01-01
    • 2021-07-29
    • 2021-07-01
    • 2022-01-08
    • 1970-01-01
    • 2021-05-09
    • 2020-10-15
    相关资源
    最近更新 更多