New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projections in MongoDB #205

Closed
ufasoli opened this Issue Jul 30, 2012 · 4 comments

Comments

Projects
None yet
3 participants
@ufasoli

ufasoli commented Jul 30, 2012

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)

Best regards

Ulises Fasoli

timowest added a commit that referenced this issue Nov 28, 2012

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Nov 28, 2012

Member

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);
Member

timowest commented Nov 28, 2012

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);
@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Jan 13, 2013

Member

Released in 3.0.0.BETA1

Member

timowest commented Jan 13, 2013

Released in 3.0.0.BETA1

@timowest timowest closed this Jan 13, 2013

@btiernay

This comment has been minimized.

Show comment
Hide comment
@btiernay

btiernay Feb 18, 2014

Does this support nested projections? For example, a single field from an array property?

btiernay commented Feb 18, 2014

Does this support nested projections? For example, a single field from an array property?

@btiernay

This comment has been minimized.

Show comment
Hide comment
@btiernay

btiernay Feb 19, 2014

I couldn't find an example that illustrates this use case. Am I overlooking something? Thanks!

btiernay commented Feb 19, 2014

I couldn't find an example that illustrates this use case. Am I overlooking something? Thanks!

@timowest timowest added this to the 3.0.0 milestone Apr 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment