I have following entity:
class Linf {
@Id
ObjectId id;
@Reference
Denied denied;
}
I want to find all Linfs that have Denied object with certain id. How can I do this? Will this query employ indexes? I want to avoid full scan if possible.
Thanx.
如果您没有“拒绝”索引,则将以任何一种方式进行完整集合扫描,但是类似的事情应该为您完成:
datastore.createQuery(Linf.class).field("denied").equal(new Key<Denied>(Denied.class, id)).fetch()
This works for me:
Denied d2 = new Denied();
d2.id = new ObjectId("52b4709f423d856472c34fa1");
List list = datastore
.createQuery(Linf.class)
.field("denied")
.equal(d2).asList();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.