root@mongodb-lab-01:~# mongo -usantanaj -ppassword --authenticationDatabase=admin < test.js MongoDB shell version v3.4.4 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.4.4 Thu Apr 27 2017 10:46:18 GMT+0200 (CEST) switched to db admin [ { "_id" : "admin.santanaj", "user" : "santanaj", "db" : "admin", "roles" : [ { "role" : "root", "db" : "admin" } ] } ] switched to db db01 { "_id" : ObjectId("5901a8eaaaae00c4a0faa95a"), "ticket" : "SERVER-28956" } bye root@mongodb-lab-01:~#