Docs Home / mongosh / Snippets / Reference

Snippet Commands代码段命令

Warning

This feature is experimental. MongoDB does not provide support for Snippets. This feature may be changed or removed at any time without prior notice.此功能是实验性的。MongoDB不支持代码段。此功能可能随时更改或删除,恕不另行通知。

Bugs are not expected, however should you encounter one, please open an issue in the GitHub repository for this project.预计不会出现错误,但如果您遇到错误,请在GitHub存储库中为此项目打开一个问题。

This document provides an overview of the commands that are available to work with snippets.本文档概述了可用于处理代码段的命令。

Commands命令

Command命令Description描述
help

Show the help text or information about a specific snippet. See an example.显示有关特定代码段的帮助文本或信息。看一个例子

snippet help
snippet help <snippet-name>
info

Show information about configured snippet repositories. See an example.显示有关已配置代码段存储库的信息。看一个例子

snippet info
install

Install a new snippet. See an example.安装新代码段。看一个例子

snippet install <snippet-name>
ls

List name and version of installed snippets. See an example列出已安装代码段的名称和版本。查看示例

snippet ls
load-all

Load all installed snippets into the current environment.将所有已安装的代码段加载到当前环境中。

snippet load-all
outdated

List snippets that have updated registry versions.列出已更新注册表版本的代码段。

snippet outdated
refresh

Clear and refresh the snippet metadata cache. See an example.清除并刷新代码段元数据缓存。看一个例子

snippet refresh
search

List available snippets, their version, and a brief description. See an example.列出可用的代码段、其版本和简要说明。看一个例子

snippet search
uninstall

Remove an installed snippet. See an example.删除已安装的代码段。看一个例子

snippet uninstall <snippet-name>
update

Get the latest versions of installed snippets获取已安装代码段的最新版本

snippet update