Попробуйте это:
Aggregation agg = newAggregation(
unwind("catalogItems"),
match(Criteria.where("catalogItems.name").regex("^" + name, "i")),
group("catalogItems._id", "catalogItems.name","catalogItems.status")
.addToSet("catalogItems.modifierId").as("modIds")
.addToSet(new Document("_id", new Document("$toString","$recipe._id"))
.append("name", "$recipe.name")
.append("menuId", "$recipe.menuId")
.append("modifiers","$modifiers")).as("recipeList"),
project()
.and("_id._id").as("_id")
.and("_id.name").as("name")
.and("_id.status").as("status")
.and(op -> new Document("$map",
new Document("input", "$recipeList")
.append("as", "recipe")
.append("in", new Document("id","$$recipe._id")
.append("name", "$$recipe.name")
.append("status", "$$recipe.status")
.append("menuId", "null")
.append("modifiers", new Document("$map",
new Document("input", new Document("$filter",
new Document("input", "$$recipe.modifiers")
.append("as", "modif")
.append("cond", new Document("$in", Arrays.asList("$$modif._id", "$modIds"))))
).append("as", "mod")
.append("in", new Document("id", "$$mod._id")
.append("recipeId", "$$mod.recipeId")
.append("displayName", "$$mod.displayName")
.append("status", "$$mod.status"))))
))).as("recipeList"));
mongoTemplate.aggregate(agg, "table", Ingredient.class).getMappedResults();
MongoPlayground