<分区>
我的firebase数据库结构是这样的
items = [
id{
country: value
likes: value
...
}
]
我想查询按喜欢排序并按国家过滤的项目 所以我使用查询 orderByChild("likes").equalTo(value, "country").limitToFirst(100)
安卓代码:
DatabaseReference ref = mDatabase.child(remotePath);
Query recentList = ref.orderByChild("likes");
if(!country.equals("")){
recentList = recentList.equalTo(country, "country").limitToFirst(100);
}
recentList.addListenerForSingleValueEvent();
但这不会返回任何结果。有没有办法一起工作? 我的偏好是让它与 firebase 查询一起使用,而不是更改我的数据库结构,因为它已经在使用中。