我是新的moleculer框架。我想使用MongoDB的聚合与moleculer框架是可能的吗?谁能告诉我如何写MongoDB的聚合查询在moleculer框架。提前感谢。
voj3qocg1#
可以在moleculer中使用mongoDB aggregate,您只需在link to moleculer-db-adapter-mongo中给出的示例中使用服务的mixins中的MongoDB Adapter。然后在该服务的任何操作中,您可以访问任何方法,如aggregate,find,count等作为this.adapter.collection.aggregate([your aggregate query])。
this.adapter.collection.aggregate([your aggregate query])
1条答案
按热度按时间voj3qocg1#
可以在moleculer中使用mongoDB aggregate,您只需在link to moleculer-db-adapter-mongo中给出的示例中使用服务的mixins中的MongoDB Adapter。然后在该服务的任何操作中,您可以访问任何方法,如aggregate,find,count等作为
this.adapter.collection.aggregate([your aggregate query])
。