我有一組這樣的檔案:
{
uid: <UNIQUE_USER_ID>,
lastLoggedIn: <TIMESTAMP_IN_NUMBER>,
...
}
當我嘗試使用以下方法獲取資料時:
Server.db
.collection(firebasePaths.funfuse_verified_users)
.where('uid', 'not-in', notToIncludeAccounts)
.orderBy('lastLoggedIn', 'desc')
.startAt(startAt)
.limit(limit)
我收到一條錯誤訊息:
Error: 3 INVALID_ARGUMENT: inequality filter property and first sort order must be the same: uid
and lastLoggedIn
這是firebase的已知限制還是我做錯了什么?我想查詢不在陣列中的所有用戶,using not-in然后根據lastLoggedIn時間戳活動對這些結果進行排序。
uj5u.com熱心網友回復:
正如錯誤訊息所說,為了能夠使用not-in,您必須首先在同一欄位上訂購:
Server.db
.collection(firebasePaths.funfuse_verified_users)
.orderBy('uid')
.where('uid', 'not-in', notToIncludeAccounts)
.orderBy('lastLoggedIn', 'desc')
.startAt(startAt)
.limit(limit)
這也意味著結果將首先排序 onuid然后(因此,如果有多個具有相同uid值的結果) on lastLoggedIn。如果您以其他順序需要它們,則必須在應用程式代碼中使用它們。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/469215.html
標籤:javascript 谷歌云火库
下一篇:使用cp功能復制節點中的檔案夾
