Solution one works! I have tried Solution three before but end with up an Exception thrown by QueryImpl class: "Can not use dot-notation past ...". Will try solution two later. What is the differences among these query methods in terms of performance?
BTW, agree with you that Tag should be List<String>. Here is a little background: i m creating a PlayFramework plugin to provide mongo db access service to user's model object. This work is based on Morphia. A draft version almost works and now i am porting the famous (to Play community) YABE(Yet Another Blog E?) sample from JPA to morphia/mongo, that's why I get a Tag{name} class here;).
What value are you using for NodeVersion? It should be your numeric
value, correct?
"versionCollection.12.userID"
> =nodeds.createQuery(History.class).filter("versionCollection.NodeVersion.userID
> elem",uid);
elem doesn't take a value like this. In this case you would your whole
NodeVersion instance for example.
nodeds.createQuery(History.class).filter("versionCollection.12 elem",
nodeVersion);
http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24elemMatch
It is usually used for collections not maps, usually.
> Either i get a Exception "com.mongodb.MongoInternalException: couldn't
> get next element" or in the later case an empty list.
> Is it possible to query an embedded HashMap? Anyone have an idea or
> can help me to reveal my mistake?
I'm a little unclear about the versionCollection. Is it a map, or a
list/collection?
Maybe it would work better to have a VersionNode include the version
as well as the user and not be a map (but a collection/list/array).