在 Inversify Express Utils 的文档中,该示例显示了如何覆盖MatchOperation matchOperation = match(Criteria.where("somekey").is("someValue"));
ProjectionOperation projectionOperation = project().andExpression("someKey").as("Key")
.andExpression("otherKey").as("SomeOtherKey");
OutOperation outOperation = out("New_Collection_Name");
Aggregation aggregation = newAggregation(matchOperation, projectionOperation, outOperation);
mongoTemplate.aggregate(aggregation, "Existing_Collection_Name", ResultClass.class);
,然后将其注入控制器中的特定路由,如here所示。 / p>
有没有办法将中间件注入每个路由,而不是在每个BaseMiddleware
装饰器中明确包含它?