文档菜单
文档首页
/ /
MongoDB CLI
/ / / /

mongocli cloud-manager performanceAdvisor suggestedIndexes list

本页内容

  • 语法
  • 选项
  • 继承选项
  • 示例

返回遇到慢查询的集合的建议索引。

性能顾问监控MongoDB认为缓慢的查询,并提出新的索引以改善查询性能。

使用此命令时,您必须使用具有项目只读角色的用户帐户或API密钥进行身份验证。

命令语法
mongocli cloud-manager performanceAdvisor suggestedIndexes list [options]
名称
类型
必需
描述
--duration
int
false
您希望返回结果的毫秒时长。如果指定了since选项,则时长从指定的日期和时间开始。如果没有设置since选项,此命令返回从当前时间之前的时长内的数据。
-h, --help
false
list的帮助
--hostId
string
true
表示MongoDB进程的主机的唯一标识符。
--nExamples
int
false
要提供的建议索引将改善的查询示例的最大数量。
--nIndexes
int
false
要建议的索引的最大数量。
--namespaces
string
false
从中检索建议索引的命名空间。
-o, --output
string
false
输出格式。有效值是json、json-path、go-template或go-template-file。要查看完整的输出,请使用-o json选项。
--projectId
string
false
表示要使用的项目的十六进制字符串。此选项覆盖配置文件或环境变量的设置。
--since
int
false
查询检索建议索引的日期和时间。指定此值为自UNIX纪元以来经过的秒数。如果没有设置duration选项,此命令从since值返回到当前时间的数据。
名称
类型
必需
描述
-P, --profile
string
false
从配置文件中使用的配置文件名。要了解MongoCLI的配置文件,请参阅https://dochub.mongodb.org/core/atlas-cli-configuration-file.
# Return a JSON-formatted list of suggested indexes for the atlas-111ggi-shard-00-00.111xx.mongodb.net:27017 host in the project with the ID 5e2211c17a3e5a48f5497de3:
mongocli [ops-manager|cloud-manager] performanceAdvisor suggestedIndexes list --processName atlas-111ggi-shard-00-00.111xx.mongodb.net:27017 --projectId 5e2211c17a3e5a48f5497de3 --output json

返回

建议索引