Docs Menu

Docs HomeView & Analyze DataMongoDB Shell

Configuration Options

On this page

  • Configuration Options
  • Examples

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>')
Option
Type
Default
Description
snippetAutoload
boolean
true
Automatically load installed snippets at startup.
snippetIndexSourceURLs
list

A semi-colon (;) separated list of one or more URLs. Each URL links to metadata about available snippets. See multiple source URLs.

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.

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.

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", "")'
←  Snippet CommandsError Handlers →