Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB YAML "Unrecognized option: security"

Tags:

yaml

mongodb

I am running Mongo DB version 2.6 on Windows Server 2012. I am having trouble setting up the YAML config file for for security and authorization. When I have the below config file I only receive an error saying "Unrecognized option: security". What is wrong with my config?

mongod_test.conf:

security:
    authorization: enabled
    authenticationMechanisms: MONGODB-CR
storage:
   dbPath: F:\MongoData

Command line:

mongod.exe --config mongod_test.conf

I've added spaces back to my file and that fixes part of the problem. With the updated config from above the current error I am getting is:

c:\MongoDBFolder\bin>mongod.exe --config mongod_test.conf
    Unrecognized option: security.authenticationMechanisms
    try 'mongod.exe --help' for more information
like image 248
SharpDevelopment Avatar asked Apr 28 '14 15:04

SharpDevelopment


2 Answers

Can't speak for your exact config, but Yaml requires colon+space to separate the keys and values, otherwise you'll get parse errors;

security:
    authorization: enabled
    authenticationMechanisms: MONGODB-CR
storage:
   dbPath: F:\MongoData
like image 144
Joachim Isaksson Avatar answered Sep 21 '22 00:09

Joachim Isaksson


Can you ensure there is a space after ":" for the key-value pair lines and also enclose the string values like dbPath value in quotes.

like image 20
aks Avatar answered Sep 17 '22 00:09

aks