MongoDB Shell error - Auth mechanism not specified


I am trying to login to a remote MongoDB server and I am running into Auth mechanism not specified error.

> mongo -u user_name -p pwd xx.x.x.xxx/db_name
MongoDB shell version: 2.6.10
connecting to: xx.x.x.xxx/db_name
2021-10-28T14:56:37.723+0000 Error: 2 { ok: 0.0, errmsg: "Auth mechanism not specified", code: 2, codeName: "BadValue" } at src/mongo/shell/db.js:1287
exception: login failed

1 Answer

3 years ago by

This is because of the old MongoDB shell. Try upgrading the shell and see if that resolves the issue.

You can upgrade by running the following command

sudo apt-get install mongodb-org-shell
3 years ago by Karthik Divi