我想为id和createTimeStamp添加组。 我的项目中有以下依赖项。
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-async</artifactId>
<version>3.3.0</version>
</dependency>
db.repocollection.aggregate(
{$match:{
$and: [
{updateTimeStamp :null},
{id : {$in:["G9A0103C17D36D46F508E566131A3C62","E9A0103C17D36D46F508E566131A3C62"]}}
]}},
{$group:{_id:"$id",id : { $first: '$id' }, "createTimeStamp": {$min:"$createTimeStamp"}}},
{$sort:{'createTimeStamp':1}}
)
return asList(
match(and(eq("updateTimeStamp", null), in("id", ids))),
));