【发布时间】:2020-05-12 04:35:59
【问题描述】:
如何使用一个查询获取不同集合中的文档数?
假设我有三个集合:1. 用户、2. 帖子、3. 聊天室。
我想创建一个返回的查询:
the total number of users, total number of posts and total number of
chatrooms
是否可以在一个 MongoDB 查询中执行此操作?解决方案是否使用聚合并不重要。任何可行的解决方案都会很棒。
【问题讨论】:
标签: mongodb mongoose mongodb-query aggregation-framework