Mongo cli not parsing .mongojs.rc file

Want to use mongo cli to autologin to my server using connection string from debian buster.

Tried to put login info in home directory file


with content
db = connect(‘localhost:27017/’);
db.auth(’’, ‘’);

but mongo cli binary is not parsing this info,

If anyone can help me understand, please do reply what am I doing wrong here???

By default mongo shell connects to localhost:27017 with no credentials. It means you have nothing to do in order to do what you want to do.


In particular You can run mongo shell without any command-line options to connect to a MongoDB instance running on your localhost with default port 27017:

1 Like