Firebase获取文件列表

发布于 2025-02-11 07:37:18 字数 158 浏览 1 评论 0 原文

在Firestore中,如果我有20个文档ID的列表,那么获取所有这些文档的最佳方法是什么?

例如,我想使用的是安哥利亚诸如搜索之类的东西,并从中获取ID列表。

我是否需要手动获取或对每个引用进行努力,还是只有使用其ID来获取文档列表的性能/简单方法?

谢谢!

In Firestore, if I have as list of, say, 20 document IDs, what is the best way to fetch all those documents?

I'm thinking of, for example, using something like Angolia for search and getting a list of ids back from it.

Would I need to manually get or onSnaptshot each reference, or is there a more performant/simple way to fetch a list of documents just using their ID?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

远山浅 2025-02-18 07:37:18

许多选项都取决于您的火灾结构如何结构化,以及您使用哪种框架来配置火箱。

一般而言,可以使用查询操作员。

在ID查询的情况下,数组是ID,您可以通过firebase.firestore.fieldpath.documentid()查询查询

import { query, where } from "firebase/firestore";

const q = query(firebase.firestore.FieldPath.documentId(), where('id', 'in', ['SOME_ID_1', 'SOME_ID_2']));


A lot of the options depends on how your firestore is structured, and what framework you're using to encorporate firebase.

Generally speaking, querying a list can be done using the in query operator.

In the case of id querying, the array is id's, and you query by firebase.firestore.FieldPath.documentId()

import { query, where } from "firebase/firestore";

const q = query(firebase.firestore.FieldPath.documentId(), where('id', 'in', ['SOME_ID_1', 'SOME_ID_2']));


~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文