0
我是使用彈簧聚合的虛擬人。
我確實有這個實體文件:Spring Data MongoDB聚合 - 獲取結果量
@Document(collection = "DocumentFile")
public class DocumentFile {
private String projectId;
private String originalFileName;
我一定要得到的具有相同專案編號分組由originalFileName(所以DocumentFile的同名應該只計算一次documentFile S上的量)
這是我的方法,但我不知道如何得到結果/數量。
final Aggregation agg = newAggregation(match(Criteria.where("projectId").in(projectId)),
group("originalFileName").count().as("amountOfDocumentFiles"));
你想各種originalFileName的特定專案編號計數?你可以添加這個集合的樣本文件嗎? – notionquest