Configuration Options配置选项
On this page本页内容
Experimental feature实验特性
This feature is experimental. 此功能是实验性的。MongoDB does not provide support for Snippets. MongoDB不支持Snippets。This feature may be changed or removed at any time without prior notice.此功能可能随时更改或删除,恕不另行通知。
Bugs are not expected, however should you encounter one, please open an issue in the GitHub repository预计不会出现错误,但如果您遇到错误,请在GitHub存储库 for this project.
中打开此项目的问题。
These options control the interaction between 这些选项控制mongosh
and the package manager that tracks individual snippet packages. mongosh
和跟踪单个代码段包的包管理器之间的交互。For more details about how a particular snippet works, see the documentation for that snippet.有关特定代码段如何工作的更多详细信息,请参阅该代码段的文档。
To modify the snippet configuration settings, use the following method:要修改代码段配置设置,请使用以下方法:
config.set('<OPTION>', '<VALUE>')
Configuration Options配置选项
snippetAutoload | boolean | true | |
snippetIndexSourceURLs | list | MongoDB Repository Index File | ; ) separated list of one or more URLs. ; )分隔的列表。 |
snippetRegistryURL | string | MongoDB npm Registry | mongosh npm client uses to install snippetsmongosh npm客户端用于安装代码段的npm注册表 |
Update the configuration options using the config command, then restart 使用config命令更新配置选项,然后重新启动mongosh
for the updates to take effect.mongosh
以使更新生效。
Examples示例
Add a Second Registry添加第二个注册表
Configure a second, private registry for sensitive snippets by adding a URL to 通过向snippetIndexSourceURLs
.snippetIndexSourceURL
添加URL,为敏感代码段配置第二个专用注册表。
config.set('snippetIndexSourceURLs',
'https://github.com/YOUR_COMPANY/PATH_TO_YOUR_REGISTRY/index.bson.br;'
+ config.get('snippetIndexSourceURLs')
)
Restart 重新启动mongosh
for the update to take effect.mongosh
以使更新生效。
Disable Snippets禁用代码段
The snippets feature requires an index source URL to function. snippets功能需要一个索引源URL才能正常工作。Unset this value then restart 取消设置此值,然后重新启动mongosh
to disable snippets.mongosh
以禁用代码段。
config.set('snippetIndexSourceURLs', '')
Snippets can also be disabled from outside 也可以从mongosh
. mongosh
外部禁用代码片段。If you cannot start 如果由于snippets配置损坏而无法启动mongosh
because of a corrupt snippets configuration, disable snippets and restart mongosh
.mongosh
,请禁用snippets并重新启动mongosh
。
mongosh --nodb --eval 'config.set("snippetIndexSourceURLs", "")'