Seperti yang Anda katakan elemMatch hanya akan mengambil objek pertama dalam array sehingga Anda harus menggunakan agregat masa depan untuk mencapai hasil Anda
MatchOperation match = Aggregation.match(Criteria.where("_id.teacherId").is("1").and("groups.students").in(11));
UnwindOperation unwind = Aggregation.unwind("groups");
GroupOperation group = Aggregation.group("_id").push("groups").as("groups").first("points").as("points");
Aggregation aggregation = Aggregation.newAggregation(unwind, match, group);
AggregationResults<BasicDBObject> groupResults = mongoTemplate.aggregate(aggregation,
CustomGroupsDocument.class, BasicDBObject.class);
List<BasicDBObject> result = groupResults.getMappedResults();