angular - 我不断收到错误消息:错误:提供给 Query.startAt() 的参数过多。使用 AngularFire2 时
问题描述
我有一个接受参数并返回数据集的简单函数
search(searchValues , numOfItems, startKey?) {
return this.db.collection('gppContract', ref => ref
.where('financialYear', '==', searchValues.financialYear)
.startAt(startKey)
.orderBy('amount', 'desc')
.limit(numOfItems + 1))
.valueChanges();
}
我做错了什么或错过了什么?我在这里不知所措。
解决方案
首先,orderBy()
需要before startAt()
,要知道结果应该是根据哪个节点。
其次,orderBy()
只接受一个参数,它应该与where()
来自文档的字段相同:
范围过滤器和 orderBy 应该在相同的字段上:
citiesRef.where("population", ">", 100000).orderBy("population")
检查这个:
https://github.com/angular/angularfire2/blob/master/docs/firestore/querying-collections.md
推荐阅读
- kotlin - FloatingActionButton 里面不显示图标?
- javascript - 登录后反应重定向(调度)
- java - 防止请求映射在 Spring Boot 中注册
- google-bigquery - Regexp_extract BigQuery
- arrays - Ansible:如何将元素分配给键名中有点的数组/变量?
- javascript - 在 JavaScript 中使用 for 循环更改 H1
- react-native - 在 React Native 中使用 Flatlist 数据导航
- android - targetSdkVersion 29 时出现错误 MediaProjection
- php - url 参数 - laravel
- weblogic12c - 提取为 .BAR 文件时,用户未显示