简体   繁体   English

Firestore查询很多文件

[英]Firestore query a lot of documents

I have a firestore database with a lot of data in it. 我有一个包含大量数据的Firestore数据库。

In my application I have to get a lot of documents from it at once. 在我的应用程序中,我必须立即从中获取很多文档。 I know the exact keys of them. 我知道他们的确切钥匙。 It is maximum 500-600 documents at a time, and an average of 300 of them, with only 3 fields in each. 一次最多500-600个文档,平均300个,每个文档中只有3个字段。 Is the best way to get them one-by-one in a new thread and request for each? 是在新线程中一个接一个地请求它们并对其进行请求的最佳方法吗? This needs a lot of parallel connections.. 这需要大量的并行连接。

This is what I do now, but it is a bit slow (several secs), I am looking for a better solution now. 这是我现在要做的,但是有点慢(几秒钟),我现在正在寻找更好的解决方案。 I have no opportunity to merge these into bigger documents, as I may need very different set of them... 我没有机会将它们合并成更大的文档,因为我可能需要不同的文档集...

I am running these on a ktor backend server. 我在ktor后端服务器上运行这些。

Using the Admin SDK, you can easily retrieve multiple documents at the same time, using getAll (linked to the documentation). 使用Admin SDK,您可以使用getAll (链接到文档)轻松地同时检索多个文档。 Simply call firestore.getAll and pass a list of document references. 只需调用firestore.getAll并传递文档引用列表即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM