Configuration Options
On this page
Warning
Experimental feature
This feature is experimental. MongoDB does not provide support for 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 for this project.
These options control the interaction between mongosh
and the package manager that tracks individual snippet packages. 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
Option | Type | Default | Description |
---|---|---|---|
snippetAutoload | boolean | true | Automatically load installed snippets at startup. |
snippetIndexSourceURLs | list | A semi-colon ( To disable snippets, unset this value. See an example. | |
snippetRegistryURL | string | The npm registry that the mongosh npm client
uses to install snippets |
Update the configuration options using the
config command, then restart
mongosh
for the updates to take effect.
Examples
Add a Second Registry
Configure a second, private registry for sensitive snippets by adding a
URL to snippetIndexSourceURLs
.
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.
Disable Snippets
The snippets feature requires an index source URL to function. Unset
this value then restart mongosh
to disable snippets.
config.set('snippetIndexSourceURLs', '')
Snippets can also be disabled from outside mongosh
. If
you cannot start mongosh
because of a corrupt snippets
configuration, disable snippets and restart mongosh
.
mongosh --nodb --eval 'config.set("snippetIndexSourceURLs", "")'