I am trying to follow the instructions here - http://docs.mongodb.org/manual/applications/replication/ and the commands that I am trying are -
1) cfg = rs.conf()
2) cfg.settings.getLastErrorDefaults = {w: "majority", j: true}
3) rs.reconfig(cfg)
When I do the first command and print the cfg object, the json document just has the _id, version and members (list). It does not have something called settings field in there for me to modify it. Because
of that when I do the 2) command, I am seeing -
" TypeError: cfg.settings has no properties (shell):1 "
Hi Raj,
It looks like the documentation is assuming a `settings` property already exists.
You should be able to set this by replacing step 2 with:
cfg.settings = { getLastErrorDefaults: {w: "majority", j: true}}
It's also worth nothing that this only sets the *default* getLastError behaviour for the replica set. It is more typical to set the desired write concern in your application code.
Cheers,
Stephen