Type: New Feature
Affects Version/s: None
Fix Version/s: 2.1 RC2 (Lovelace)
Dear Spring Data Team,
by default, the MongoTemplate doesn't look at the provided class to determine the required fields. So the projection is not restricted and the whole document is retrieved.
For example, the following code is only interested in the id field of the document:
But when I look at the Mongo logs, I see an empty projection.
So I have to set up the projection manually:
Would it be a useful feature if the MongoTemplate automatically scans the class and create a projection clause containing only the relevant fields?
I already had a short discussion with Oliver about this topic on Twitter: https://twitter.com/philipp_hauer/status/1023945360589434882