MongoDB mongod -f <config-dir>

storage:
dbPath: “/data/db”
net:
bindIp: 192.168.103.100,localhost
port: 27000
security:
authorization: “enabled”

using the above mongod.conf file, I got “Unrecognized option: security” message

can anybody point out what is wrong?

Indentation is very important in YAML

Try this way

security:
authorization: enabled

storage:
  dbPath: /data/db

net:
  bindIp: 192.168.103.100,localhost
  port: 27000

security:
  authorization: "enabled"

@Ramachandra_37567 had already mentioned the issue is identation, but at least in my browser I could not see the correct indentation in his either

Hope this helps!

Cheers

What is the error you get?

still saying the same thing “unrecognized option: security”

unrecognized option: security

Cannot say about your exact config, but Yaml requires colon+space to separate the keys and values else you’ll get parse errors

security:
    authorization: enabled

In my earlier post i tried to show that but when i saved both security and authorization showing without indentation
authorization should move to right by 2 cursors
Try different options
Are quotes needed?Try without quotes

According to this answer you may need to write a space after the colon.

I did not need to do this on my conf file though, so I am not sure why this is.

Are you on windows? What program do you use to edit your config file?

Try adding spaces after the colon ( : ) , you can also try to change the order of the parameters

storage:
  dbPath: /data/db

security: 
  authorization: "enabled"

net:
  bindIp: 192.168.103.100,localhost
  port: 27000

and see if you still get this error

1 Like