大家好,在嘗試打開帶有查詢的頁面時,應用程式開始一次又一次地終止。我沒有得到創建索引或類似的鏈接,它只是在 iOS 和 android 上終止,我收到以下錯誤。
這是代碼
idofotheruser = await FirebaseFirestore.instance
.collection('meinprofilsettings')
.doc(user)
.collection('BlockedUser')
.limit(10)
.get();
idofotheruser.docs.forEach((element) {
listOfIds.add(element.id);
});
if (idofotheruser.docs.length > 0) {
print("test123");
print(widget.hashtag);
try {
querySnapshots = await FirebaseFirestore.instance
.collection('videos')
.where('uid', whereNotIn: listOfIds)
.where('Hashtagsforallvideos', arrayContains: widget.hashtag)
.orderBy("uid")
.limit(13)
.get();
An error occurred while parsing query arguments, this is most likely an error with this SDK.
E/FLTFirestoreMsgCodec(16249): java.lang.IllegalArgumentException: Invalid Query. You cannot use 'not_in' filters with 'array_contains' filters.
我也試過這樣
await FirebaseFirestore.instance
.collection('videos')
.where('Hashtagsforallvideos', arrayContains: widget.hashtag)
.limit(15)
.get()
.then((value) => {
if (value.docs.isNotEmpty)
{
value.docs.forEach((doc) {
if (doc.data()['uid']) {
} else {}
// doc.data() is never undefined for query doc snapshots
}),
}
uj5u.com熱心網友回復:
錯誤很明顯:
您不能將“not_in”過濾器與“array_contains”過濾器一起使用。
您不能在查詢中組合這兩個子句:
.where('uid', whereNotIn: listOfIds)
.where('Hashtagsforallvideos', arrayContains: widget.hashtag)
從查詢限制的檔案中:
每個查詢最多可以使用一個 array-contains 子句。您不能將 array-contains 與 array-contains-any 結合使用。
每個查詢最多可以使用一個 in、not-in 或 array-contains-any 子句。您不能在同一個查詢中組合 in 、 not-in 和 array-contains-any 。
如果您需要按這兩個條件進行過濾,則必須在查詢中執行一個,在應用程式代碼中執行另一個。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/366991.html
標籤:火力基地 扑 镖 谷歌云firestore
上一篇:如何在Jetpackcompose中檢測Horizo??ntalPager()中的滑動?
下一篇:Flutter函式重新加載變數
