I keep getting the error: Error: Too many arguments provided to Query.startAt(). when using AngularFire2
I keep getting the error: Error: Too many arguments provided to Query.startAt(). when using AngularFire2
我有一个接受参数和returns数据集
的简单函数
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()
需要在startAt()
之前,才能知道结果应该根据哪个节点。
其次,orderBy()
只接受一个参数,它应该是与 where()
相同的字段,来自文档:
Range filter and orderBy should be on the same fields:
citiesRef.where("population", ">", 100000).orderBy("population")
检查这个:
https://github.com/angular/angularfire2/blob/master/docs/firestore/querying-collections.md
我有一个接受参数和returns数据集
的简单函数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()
需要在startAt()
之前,才能知道结果应该根据哪个节点。
其次,orderBy()
只接受一个参数,它应该是与 where()
相同的字段,来自文档:
Range filter and orderBy should be on the same fields:
citiesRef.where("population", ">", 100000).orderBy("population")
检查这个:
https://github.com/angular/angularfire2/blob/master/docs/firestore/querying-collections.md