I am new to using mongo aggregate query, where in the below query I use projectIdList and group totalCount & totalAmount. How can I get the individual projectId long with its totalCount and totalAmount.
Aggregation aggregate = newAggregation(
match(Criteria.where("projectId").in(projectIdList)
.and("isAvailable").in(false)
.and(status).in("rejected")
.and(updatedTime).gt().lt()),
group("projectId").count().as("totalCount")
.sum(ConvertOperators.Convert.convertValueOf("amount").to("decimal").as("totalAmount"));
Please suggest.