I have an object which has 3 fileds:
public class tags{
@Property("n")
private String name;
@Property("t")
private int type;
@Property("r")
private int rank;
.....
}
I am using morphia to communicate to my MongoDB.
I want to save al lthe fileds to the DB, but while retreiving I want to query only based on the 'name' and 'type' fields within my object. I have tried using the @Transient Annotation, but it completely ignores the field during load/save.
This is a very common use case.
The morphia wiki describes using filters or fluent interface: https://github.com/mongodb/morphia/wiki/Query#wiki-filter
Here's an example:
ds.createQuery(tags.class).field('name').equal('idbentley').field('type').equal(1);