Ok, the idea is this:
Given a model such as:
Release {
Work[] works = ....
}
and
Work {
String title;
}
I get how to search for Releases using as criteria "has a Work with title=whatever":
DBObject crit = new BasicDBObject();
crit.put("works", new BasicDBObject("$elemMatch",new BasicDBObject("title", "whatever")));
I also get how to use regex for basic stuff, such as "get all Works which have a tile containing whatever":
crit.put("title", "/.*whatever.*/");
But how do I go about doing something like "get all Releases which have a Work with title that CONTAINS whatever" ?
If I try this, I get nothing:
crit.put("works", new BasicDBObject("$elemMatch",new BasicDBObject("title", "/.*whatever.*/")));
Thanks