I\'m a new Mongodb and I have a problem with $lookup with java spring.
I would like to use this shell in Spring data
db.NewFeed.aggregate([
{
Its too late to answer this, but it might helps other who are facing the same issue. If you are using spring-boot-data-mongodb-2.0 or above version then there is a easy way to implement this.
AggregationOperation match = Aggregation.match(Criteria.where("username").is("user001")));
AggregationOperation query = Aggregation.lookup("NewfeedContent", "content.contentId", "_id", "NewfeedContent");
// If you want to unwind
//AggregationOperation unwind = Aggregation.unwind("Patient");
Aggregation agr = Aggregation.newAggregation(query, match, unwind);
AggregationResults result = springTemplate.aggregate(agr, "CollectionName", Document.class);