- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
如何获取MongoDB聚合查询执行时间?
我试过这个:
db.collection.explain("executionStats").aggregate(
[ { '$match': { '$and': [ { 'meta.client_id': { '$eq': 1 } },
{ 'meta.is_deleted': { '$ne': 1 } } ] } },
{ '$group':
{ _id: '$Plant',
value: { '$sum': 1 } } },
{ '$sort': { _id: 1 } } ]
)
但这是返回阶段 queryPlanner
、winningPlan
和 rejectedPlans
而不是 executionStats
.我想获得以毫秒为单位的查询执行时间。
最佳答案
在 MongoDB 3.6 之前,解释 aggregate
命令只支持默认的 queryPlanner
冗长模式并忽略任何其他选项(参见:SERVER-19758)。
您需要将 MongoDB 服务器升级到 3.6 或更新版本才能使用 additional verbosity modes使用 aggregate
命令。
关于mongodb - 如何在 MongoDB 3.4.10 中获取用于聚合的 executionStats?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51112077/
我正在使用 MongoDB 3.0.4,并且我有一个包含我想要聚合的数据的数据库。问题是,它需要的时间比它应该的要长。我做了功课(至少我猜),我看到了函数 explain() 和很多关于聚合和索引优化
我看到它们返回完全相同的东西,为什么要使用一个而不是另一个? 代码: const explainQuery = collection.find().sort({last_modified:-1}).l
我对包括解释在内的请求有疑问。例如,以下请求效果很好: pp.pprint(col.find({"cuisine":"Italian"}, {"name" : 1, "address.zipcode"
如何获取MongoDB聚合查询执行时间? 我试过这个: db.collection.explain("executionStats").aggregate( [ { '$match': { '$and
我是一名优秀的程序员,十分优秀!