firebase - 使用 Flutter 在一次往返中从 firestore 获取 10 多个文档
问题描述
我目前正在whereIn
为此使用。但一次只能获得 10 个或更少的文件。根据 Firestore 文档,其中 10 个或更少的条目
有什么方法可以在一次往返中一次获取 10 多个文件?
return _db
.collection('books')
.where('docId', whereIn: ['id1', 'id2'...'id10'])
.get()
.then((value) => value.docs.map((e) => BookModel.fromFireStore(e)).toList());
解决方案
不,10 是硬限制,不能超过。您将需要执行多个查询才能按 ID 获取超过 10 个文档。该文档指出:
使用
in
运算符将同一字段上的最多 10 个相等 (==) 子句与逻辑 OR 组合在一起。
推荐阅读
- ios - 如何使用 Swift 5 的代理配置连接到 HTTP 服务器(为什么忽略 connectionProxyDictionary)?
- c++ - 在这种情况下使用指针有什么好处或必要性:
- jquery - 如何在控制器中获取 jquery 序列化数据并存储到数据库
- pandas - 将值重新格式化为单独的列
- flutter - 颤振 - NoSuchMethodError JSON
- jquery - 如果字段在手风琴内,MVC 必填字段验证不起作用
- mongodb - MongoError: $match with $text 只允许作为第一个管道阶段
- android - 如何在 ViewPager2 中实现 Spinner
- jquery - 如何为 Magnific Popup 自动播放视频
- php - PHP数组值减法直到最后一个值