首页 文章

从firestore下载一系列文档

提问于
浏览
1

我可以从 firestore 获取某些 array of documents 吗?

我有用户,每个用户都有一定的 id . 此 idfirestore 中的文档同名 . 例如:

First user 在分支中有 id

  • 城市

  • Oko

Second user 在分支中有 id

  • 001Zaria0029

  • Avangard

我的用户存储在 database 中,如下所示:

enter image description here

firestore 这个数据 stored 是这样的:

enter image description here

因此,当 first user 进入应用程序时,他必须看到 CityOko 或当 second user 进入应用程序时,他必须看到 001Zaria0029Avangard .

如何为用户获取不同的数据?不改变 firestore 中的结构 .

我认为需要在数组中添加id并从firestore中获取,但我无法弄清楚如何请求这样的数组 . 请帮忙 .

我知道如何将一个id收集到一个数组中,但后来我无法理解如何请求这个数组 .

1 回答

  • 1

    Firestore中没有"array fetch" . 如果您需要多个文档,只需使用多次调用getDocument()单独请求它们 .

相关问题