谁能提供有关如何自定义羽毛服务以执行mongodb聚合管道的基本示例?我已经用钩子尝试过,但是我在中途迷路了。
您可以在FeathersJs中创建Custom Service,在该类中可以使用聚合,也可以在钩子中使用它。
Custom Service
EX:我有一些服务用户,我想通过聚合获取数据。
const userData = context.app.service('users').Model.aggregate([ // Use Your pipelines here ]);