我们无法获得严重性......我们只能获得严重性计数。我们需要一起使用查找和组操作。
LookupOperation lookupp = LookupOperation.newLookup()
.from("defect").localField("defid").foreignField("defid")
.as("defectsLst");
MatchOperation match = new MatchOperation(Criteria
.where("projectid").is(projectid)
.andOperator(Criteria.where("type").is("File")));
GroupOperation group = new GroupOperation (Fields.fields("$defectsLst.severity"))
.count().as("sevCount");
Aggregation agg = Aggregation.newAggregation(lookupp,
match,group);