【发布时间】:2018-12-19 16:06:37
【问题描述】:
我想在 Spring Boot 应用程序中获取此 MongoDB 查询的结果。
db.getCollection('contentSource').aggregate( [ { $sort: { "modified": -1 } },
{ $group: { _id: "$sourceId", cs: { $push: "$$ROOT" } }},
{ $replaceRoot: { newRoot: { $arrayElemAt: ['$cs', 0] } }} ] )
有人知道如何将 replaceRoot 添加到我的聚合中吗?
【问题讨论】:
标签: spring mongodb aggregation