Lab: configuration file

I am new to mongo db and I am stuck with configuration assignment i got the following error when I click run test

3 total, 1 passed, 0 skipped:
[PASS] “The server is running on localhost:27000”
[FAIL] “The server requires authentication”

Don’t forget to launch mongod with authentication enabled!
You can do this using the configuration file.

[FAIL] “Mongod was started with a configuration file”

Did you launch mongod using a configuration file?

and i made changes to my mongod.conf file as shown below:

net:
port: 27000
bindIp: 127.0.0.1

security:
Authorization:enable

Kindly let me know where i am going wrong.

Thanks

Hi,

YAML related

  • Needs to be a space after the :. Example key: value
  • Subfields have to be indented. Example:
key:
  subField: value

Typo

  • Use authorization, all lowercase

And you could remove:

  • the bindIp (it is the default).
1 Like

Post a screenshot of the IDE that shows the command you used to start mongod.

From the error message:

You most likely did not start mongod with the configuration file. The configuration file would likely have mongod to fail to start but you got:

so I suspect you started mongod with the command mongod --port 27000 or something like that.

Hi Steve,

Yes I started the mongod with the command mongod–port 27000 which connected me to the local host.
Then at the next terminal I tried connecting mongod with the configuration file setup up by changing port number and authorisation as enabled in mongod cnf file . and used the syntax mongod --conf (location where i stored my mongod cnf file with the changes) mongod .conf.
not sure if my syntax i used is write to config the file .

i used the below syntax:

mongod -f C:\Users\Nevin\Documents mongod.conf

thanks
Nevin

@Santiago_Miranda already pointed you to the syntax errors in your configuration file.

You seem to do not know the difference between the commands mongod, which starts a server, and mongo, which start a client and connect it to a server. So the command *mongod --port 27000 did not connected you to the local host. It started a server listening to port 27000 on the local host. In this lab, you are asked to use the configuration file. In my version of the lab, they explicitly list the 2 different ways to do that. Yours is probably the same. So why did you try:

Your configuration file is in the IDE. You are supposed to run the commands in the IDE. The IDE does not have access to your C: drive.

Thank you it worked

Thank you it worked thanks for the help