我有RealmObject(让我们说Owner)它有RealmList<Cat>.Cat有房产name.如何查询所有Owner拥有指定名称的猫?
我试过了:
RealmResult<Owner> owners = realm.query(Owner.class)
.contains("cats", "Garfield")
.findAll();
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
PS最有可能重复,但无法找到.
bee*_*der 19
. 可以在查询子对象/列表字段时使用,对于您的情况,请尝试以下操作:
RealmResult<Owner> owners = realm.query(Owner.class)
.contains("cats.name", "Garfield")
.findAll();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5383 次 |
| 最近记录: |