对于 AI 代理:可在 https://www.mongodb.com/zh-cn/docs/llms.txt 获取文档索引—通过在任何 URL 路径后添加 .md 可获取所有页面的 Markdown 版本。

为 MongoDB CLI 启用自动完成功能

您可以为 MongoDB CLI 命令启用自动完成功能,以直接在 shell 中查看可用命令及其语法。

如果您使用 Homebrew 安装了MongoDB CLI ,则安装中包含自动完成功能。您必须配置Shell以启用其完成支持。 要为Shell启用autocomplete,请参阅 Homebrew 文档。

配置自动完成功能后,您可以通过在 shell 中键入mongocli并按Tab键来自动完成命令。 按多次Tab可在可用的自动完成选项之间循环。

您可以在编写命令的任何阶段按Tab ,查看可用的自动完成选项。

当您在 Shell 中键入mongocli并按Tab时,输出将类似于以下内容:

atlas -- Atlas operations.cloud-manager -- Cloud Manager operations.completion -- Generate shell completion scriptsconfig -- Configure a profile to store access settings for your MongoDB deployment.help -- Help about any commandiam -- Organization and projects operations.ops-manager -- Ops Manager operations.

如果您键入特定属性(例如atlas作为命令的一部分,则可以看到所选属性的自动完成选项。

例如,当您在 Shell 中键入mongocli atlas并按Tab时,输出将类似于以下内容:

accessLists -- Manage the IP access list for your project.accessLogs -- Manage the access logs of a cluster.alerts -- Manage alerts for your project.backups -- Manage backups for your project.clusters -- Manage clusters for your project.dbusers -- Manage database users for your project.events -- Manage events for your project.logs -- Download host logs for your project.metrics -- Get measurements on the state of the MongoDB process.processes -- Manage MongoDB processes for your project.