Warning: Found ~/.mongorc.js, but not ~/.mongoshrc.js. ~/.mongorc.js will not be loaded

( This is from my machines cmd @ windows 10 )
Warning: Found ~/.mongorc.js, but not ~/.mongoshrc.js. ~/.mongorc.js will not be loaded.
You may want to copy or rename ~/.mongorc.js to ~/.mongoshrc.js.

this below matches the info from Student-test Overview in Atlas

Atlas atlas-ej2x43-shard-0 [primary] student-1>

Howdy Folks newbie here with a question / error message. I was having issue’s getting the MongoDB-shell to work. Was following the University install instructions and every time I went to connect. It would fail and I finally removed everything Mongo from the machine. Running Windows10 Pro and I checked Program Files / Program-86 / AppData Local and Roaming. Even checked that the Environmental Variables Path was empty.

While I am following a few different tutorials some say use Compass, the next one says use the Shell. So I thought there was a conflict in paths. So after a restart from MongoDB Shell Download | MongoDB I selected tools and downloaded -v 1.1.0 Win64-bit msi

I ran the msi and Unchecked just for me to install it in Programs path. I have a Cluster built from following the University follow along and removed everything. I built a new Project in Atlas and it is up and just finished loading the sample data. When I hit connect and selected Shell the string supplied match’s what I have on my machines command line. Provide screen shots.

It has the WARNING message I am concerned with now. And on how to handle it or ignore it ?? I have some experience with node.js and running npm for packages and dependencies. So a lot are just deprecation warnings that handle themselves. This is my first try getting it running on my own and still a little squirrely.

Any explanations and time appreciated. Just unsure if it will lead to failures down the road.

Thanks again and …Peace

cmd and Atlas Project info


Just to add the follow along tutorial has you add a bogus url and was what I used when it failed. This time I selected Use My url and it connected. If that has any bearing on it ??

I have exactly the same issue (in MacOS) but didn’t know how to correct it. Any help, please?

Hi @William_Rutkowski, @Mariluz_de_la_Parra,

This warning message is ignorable. It happens when you have previously run the legacy mongo shell (which creates a .mongorc.js in your home directory) and subsequently run the new MongoDB Shell (mongosh) which looks for .mongoshrc.js instead.

The “rc” file naming convention comes from Unix, where it indicates “Run Commands” that are invoked when an application starts up. In the context of the MongoDB shell, the rc file can be used to load some additional JavaScript commands or helpers:

On startup, mongosh checks the user’s HOME directory for a JavaScript file named .mongoshrc.js . If this file is found, mongosh interprets the content of .mongoshrc.js before displaying the prompt for the first time.

The mongosh startup warning is trying to convey that a legacy .mongorc.js file was found but will not be loaded by mongosh. If you added any custom JavaScript in .mongorc.js, you may want to update and add those commands to .mongoshrc.js. This is suggested in the second line of the warning:

You may want to copy or rename ~/.mongorc.js to ~/.mongorcsh.js

You can inspect the contents of these JavaScript files in your favourite text editor.



That’s very helpful. Thank you very much!

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.