Docs Home → View & Analyze Data → MongoDB Shell
.mongoshrc
Configuration File
On this page
On startup, mongosh
checks your HOME
directory for a
JavaScript file named .mongoshrc.js. If this file is found,
mongosh
reads the content of .mongoshrc.js before
displaying the prompt for the first time.
If you use mongosh
to evaluate a JavaScript file or
expression, either by using the --eval
option
on the command line or by specifying a .js file, mongosh
reads .mongoshrc.js
after the JavaScript has finished processing. You can prevent
.mongoshrc.js from being loaded by using the --norc
option.
Note
Example Usage
You can use the .mongoshrc file to customize mongosh
startup
behavior and add scripted functionality. For examples, see
Execute Code From a Configuration File.