Lab - Creating First Application User: "couldn't add user: there are no users authenticated"

Hi there:

I’m trying to create the user the same way we did in the first lab and I get this error:

vagrant@m103:~$ mongo admin --host localhost:27000 --eval 'db.createUser({user: "m103-application-user", pwd: "m103-application-pass", roles: [{role: "readWrite", db: "applicationData"}]})'
MongoDB shell version v3.6.14
connecting to: mongodb://localhost:27000/admin?gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("cc24ddd0-75df-44a5-b7b0-44c02adb5c4d") }
MongoDB server version: 3.6.14
2019-09-27T09:06:11.034+0000 E QUERY    [thread1] Error: couldn't add user: there are no users authenticated :
@(shell eval):1:1

This is my mongod.conf:

  bindIp: ",localhost"
  port: 27000
  mode: "slowOp"
  slowOpThresholdMs: 50
  fork: true
  authorization: enabled
  dbPath: "/var/mongodb/db/"
  destination: "file"
  logAppend: true
  path: "/var/mongodb/db/mongod.log"

OK, I have done this:

mongo --host localhost:27000 -u "m103-admin" -p "m103-pass" --authenticationDatabase admin

It worked, so I tried to create the user:

db.createUser({user: "m103-application-user", pwd: "m103-application-pass", roles: [{role: "readWrite", db: "applicationData"}]})

And it worked again, but when I try to validate:

Client experienced a timeout when connecting to the database - check that mongod
is running on the correct port, and that the 'm103-application-user' user
authenticates against the admin database.

OK, I forgot to switch to admin database before creating the user, problem solved.