spring-mongo

MongoDB $aggregate $push multiple fields in Java Spring Data

我的未来我决定 提交于 2019-11-28 00:15:57
I have a mongo aggregate group query: db.wizard.aggregate( { $group: { _id: "$title", versions: { $push: {version:"$version", author:"$author", dateAdded:"$dateAdded"}} } }) I need this query in Java Spring-Data-MongoDB, my current solution looks like this: Aggregation agg = Aggregation.newAggregation( Aggregation.group("title"). push("version").as("versions") ); Problem is that i don't know how to add more fields to push method (version, author, dateAdded). Is it possible with Spring-Data-MongoDB? You can directly pass the BasicDbObject to any of the aggregation pipeline stage. Aggregation

MongoDB $aggregate $push multiple fields in Java Spring Data

ε祈祈猫儿з 提交于 2019-11-26 21:38:44
问题 I have a mongo aggregate group query: db.wizard.aggregate( { $group: { _id: "$title", versions: { $push: {version:"$version", author:"$author", dateAdded:"$dateAdded"}} } }) I need this query in Java Spring-Data-MongoDB, my current solution looks like this: Aggregation agg = Aggregation.newAggregation( Aggregation.group("title"). push("version").as("versions") ); Problem is that i don't know how to add more fields to push method (version, author, dateAdded). Is it possible with Spring-Data

Mongodb $lookup in Spring data mongo

删除回忆录丶 提交于 2019-11-26 21:22:07
问题 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([ { $match : {username : "user001"} }, { $lookup: { from: "NewfeedContent", localField: "content.contentId", foreignField: "_id", as: "NewfeedContent" } } ]) I found on Google but no answer yet. 回答1: Not every "new" feature makes it immediately into abstraction layers such as spring-mongo. So instead, all you need do is define a class that uses the