Docs 菜单
Docs 主页
/ /
Atlas CLI
/ / /

atlas performanceAdvisor suggestIndexes 列表

在此页面上

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

为查询速度慢的collection返回建议的索引。

Performance Advisor 会监控 MongoDB 认为其速度缓慢的查询,并建议使用新索引来提高查询性能。

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

命令语法
atlas performanceAdvisor suggestedIndexes list [options]
名称
类型
必需
说明
--duration
int
false
要返回结果的时间长度(以毫秒为单位)。 如果指定 since 选项,则持续时间从指定的日期和时间开始。 如果未设置since选项,则此命令将返回当前时间之前的持续时间的数据。
-h,--help
false
列表帮助
--nExamples
int
false
提供建议索引将改进的最大示例查询数。
--nIndexes
int
false
建议的最大索引数。
--namespaces
字符串
false
从中检索建议索引的命名空间。
-o, --output
字符串
false
输出格式。 有效值为 json、json-path、go-template 或 go-template-file。 要查看完整输出,请使用 -o json 选项。
--processName
字符串
true
MongoDB 进程主机的唯一标识符,格式如下:{hostname}:{port}。 运行“atlas processes list”命令时,您可以从“id”字段获取可能值的列表。
--projectId
字符串
false
标识要使用的项目的十六进制字符串。 此选项会覆盖配置文件或环境变量中的设置。
--since
int
false
查询检索建议索引的日期和时间。 将此值指定为自 UNIX 纪元以来经过的秒数。 如果未设置持续时间选项,此命令将返回从起始值到当前时间的数据。
名称
类型
必需
说明
-P, --profile
字符串
false
要从配置文件中使用的配置文件的名称。 要了解 Atlas CLI 的配置文件,请参阅 https://dochub.mongodb.org/core/atlas-cli-save-connection-settings。
# 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:
atlas performanceAdvisor suggestedIndexes list --processName atlas-111ggi-shard-00-00.111xx.mongodb.net:27017 --projectId 5e2211c17a3e5a48f5497de3 --output json

后退

suggestIndexes