列出 mongo 数据库或集合中的所有查询形状
List all the query shapes in mongo database or collection
我正在浏览官方网站上的文档,在浏览索引部分的详细信息时偶然发现了 term query-shape
。
细节看起来很有趣,很可能这些细节的列表可以帮助我解决在我计划载入现有已部署应用程序时向集群提出的所有可能查询。
但我现在的问题是,有没有办法在命令行上为一个集合(或完整的数据库)执行上述操作?
附带说明一下,我同时使用 compass 社区和 robo3t 作为通过 CLI 构建的工具来访问数据存储区,并且对 运行 mongo shell 上的命令直接感到满意也是。
通过更多的时间和努力,我找到了 PlanCache.listQueryShapes
,它与我使用的 mongo 的最新版本略有不同。
好像是$planCacheStats
introduced in 4.2 was something I was looking forward to. The following query helped me list all the query shapes over a collection as mentioned in the list query shapes部分。
db.user_collections.aggregate( [ { $planCacheStats: { } } ,
{ $project: {createdFromQuery: 1, queryHash: 1 } } ] )
我正在浏览官方网站上的文档,在浏览索引部分的详细信息时偶然发现了 term query-shape
。
细节看起来很有趣,很可能这些细节的列表可以帮助我解决在我计划载入现有已部署应用程序时向集群提出的所有可能查询。
但我现在的问题是,有没有办法在命令行上为一个集合(或完整的数据库)执行上述操作?
附带说明一下,我同时使用 compass 社区和 robo3t 作为通过 CLI 构建的工具来访问数据存储区,并且对 运行 mongo shell 上的命令直接感到满意也是。
通过更多的时间和努力,我找到了 PlanCache.listQueryShapes
,它与我使用的 mongo 的最新版本略有不同。
好像是$planCacheStats
introduced in 4.2 was something I was looking forward to. The following query helped me list all the query shapes over a collection as mentioned in the list query shapes部分。
db.user_collections.aggregate( [ { $planCacheStats: { } } ,
{ $project: {createdFromQuery: 1, queryHash: 1 } } ] )