如何在Moleculer中使用MongoDB聚合

4ioopgfo  于 2023-03-22  发布在  Go
关注(0)|答案(1)|浏览(184)

我是新的moleculer框架。我想使用MongoDB的聚合与moleculer框架是可能的吗?谁能告诉我如何写MongoDB的聚合查询在moleculer框架。提前感谢。

voj3qocg

voj3qocg1#

可以在moleculer中使用mongoDB aggregate,您只需在link to moleculer-db-adapter-mongo中给出的示例中使用服务的mixins中的MongoDB Adapter。然后在该服务的任何操作中,您可以访问任何方法,如aggregate,find,count等作为this.adapter.collection.aggregate([your aggregate query])

相关问题