gpt4 book ai didi

java - Firestore 查询 AndroidWhereEqualTo

转载 作者:行者123 更新时间:2023-12-02 11:38:08 26 4
gpt4 key购买 nike

我想要做的是查找“usuarios”等于“amigos”的所有文档。问题是“amigos”是一个列表。我希望你带上你在该列表中找到的所有字符串( friend )的所有文档。但我收到此错误:

UNIMPLEMENTED: Unsupported FieldFilter value type: 9

CollectionReference collectionReference = db.collection("eventos");

collectionReference.whereEqualTo("usuario", amigos).limit(15).orderBy("hora", Query.Direction.DESCENDING).get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {

enter image description here

最佳答案

您收到该错误是因为您尝试使用不支持类型过滤器来过滤数据。您的 amigos 文件是一个 ArrayList,不能用于过滤数据。 whereEqualTo() 方法的第二个参数永远不能是 ArrayList。您只能按 supported data types 进行过滤。不幸的是,Firestore 不支持 ArrayList。

另请参阅Query.whereEqualTo(String field, Object value) :

Creates and returns a new Query with the additional filter that documents must contain the specified field and the value should be equal to the specified value.

关于java - Firestore 查询 AndroidWhereEqualTo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48780934/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com