MongoDB YAML file problems on Windows

mongodbwindows 8

I managed to get MongoDB running as a three member replica on Windows 8, but I had problems with configuration files. If I used the new (MongoDB 2.6) file format (YAML) and used the replica set name option as:

replication:
    replSetName: rs1

(or any of the other variants I had tried in YAML format) I would get "Invalid option: replication" error during the installation. When I switched to old conf. file format and used:

replSet=rs1

I had no problems.
I am very (very!) new to all this, so I am wondering if I was doing something wrong or is it Mongo 2.6 – Windows problem. Thanks!

Best Answer

I was not able to replicate, so here's my successful YAML config file (Windows 7 64 bit, MongoDB 2.6.1):

replication:
    replSetName: "rs1"
    oplogSizeMB: 512
storage:
    dbPath: "data"
    smallFiles: true
systemLog:
    destination: file
    path: "data/mongod.log"

How I started it:

C:\Users\Adam\mongo\2.6.1\bin>mongod.exe -f mongod-yaml.conf
2014-06-03T23:23:12.528+0100 log file "C:\Users\Adam\mongo\2.6.1\bin\data/mongod
.log" exists; moved to "C:\Users\Adam\mongo\2.6.1\bin\data/mongod.log.2014-06-03
T22-23-12".

And then (after an rs.initiate()):

rs1:PRIMARY> db.serverCmdLineOpts()
{
        "argv" : [
                "mongod.exe",
                "-f",
                "mongod-yaml.conf"
        ],
        "parsed" : {
                "config" : "mongod-yaml.conf",
                "replication" : {
                        "oplogSizeMB" : 512,
                        "replSetName" : "rs1"
                },
                "storage" : {
                        "dbPath" : "data",
                        "smallFiles" : true
                },
                "systemLog" : {
                        "destination" : "file",
                        "path" : "data/mongod.log"
                }
        },
        "ok" : 1
}

Note that I had issues when I used tabs to indent, which were resolved when using spaces. Case sensitivity was also a problem, but mainly due to muscle memory from the old config options.