Here's the relevant section of the docs concerning repositories. Also the section on querying documents has a brief mention of it.
When using MongoOperations
you can use the Query
instance to restrict the result to certain fields:
Query query = Query.query(Criteria.where("lastname").eq("…"));
// Configure the field spec you want to use for this query
query.fields().include(…).slice(…);
I've filed DATAMONGO-839 to improve the discoverability of this and also polish the JavaDoc of the Query
class.