It would be great if the MongoDBQuery could support projections as the HibernateQuery does as explained in this post
According to the Mongo offcial documentation much better performances can be achieved when selecting only relevant fields in a query MongoDB Documentation (Optimization # 3: Select only relevant fields)
#205 added Mongodb query projections
Projections can now be used via the overloaded list, singleResult, uniqueResult and listResults methods. The projection type is the same as for the other methods to be consistent with previous Mongodb query behaviour.
e.g. User with only firstName and lastName mapped
User u = query.where(user.firstName.eq("Jaakko")).singleResult(user.firstName, user.lastName);
Released in 3.0.0.BETA1
Does this support nested projections? For example, a single field from an array property?
I couldn't find an example that illustrates this use case. Am I overlooking something? Thanks!