本文介绍了如何在Realm中进行嵌套查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个境界:
public class ChatRealm extends RealmObject {
private String id;
private RealmList<UserRealm> users;
}
public class UserRealm extends RealmObject {
private String id;
private String username;
}
我有一个用户ID,我想知道他正在参加哪些聊天.我检查了Realm文档,找不到如何进行此类查询.
I have an User id and I want to know which chats he is participating in. I have check the Realm documentation and couldn't find how to do this type of queries.
如何使用Realm查询获得想要的结果?
How can I get the results I want using a Realm query?
推荐答案
文档中的链接查询如何?有一个例子:
How about link query in documentation?There is an example:
RealmResults<ChatRealm> contacts = realm.where(ChatRealm.class).equalTo("users.id", "some id").findAll();
这篇关于如何在Realm中进行嵌套查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!