Firebase Firestore:orderBy与导致错误“操作被拒绝"的位置结合在一起. [英] Firebase Firestore: orderBy combined with where causes error "Operation was rejected"
问题描述
我正在查看Firebase Cloud Firestore
提示任何需要它的人,
如果您忘记创建索引并遇到上述错误,请运行 adb logcat
,然后尝试再次加载数据-通常会提供一个URL链接,该链接会非常友好地创建您需要的索引.
I am looking at the Firebase Cloud Firestore documentation for orderBy. When I try to execute this
var facultyQuery = facultyRef.where("department", "==", "Core Teacher").orderBy('bb_last_name', 'desc');
I get the error:
Error: Firestore: Operation was rejected because the system is not in a state required for the operation`s execution. (firestore/failed-precondition).
Both of these simpler cases work just fine:
var facultyQuery = facultyRef.orderBy('bb_last_name', 'asc');
var facultyQuery = facultyRef.where("department", "==", "Core Teacher");
But when I combine the where and the orderBy, something I have done before with other Firestore collections, it fails.
Here is a sample record:
Tip for anyone that needs it,
If you've forgotten to create an index and are getting the above error, run adb logcat
and then attempt to load the data again - it usually gives you a URL link which will very kindly create the required index for you.
这篇关于Firebase Firestore:orderBy与导致错误“操作被拒绝"的位置结合在一起.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!