Hi all.
Is it possible to initiate a replicaset using the nodejs driver? Currently we’re using a shell script to do so.
mongo --eval '
if (!db.isMaster().ismaster) {
rs.initiate(
{
_id: "rs0",
members: [
{
_id: 0,
host: "localhost:27017"
}
]
});
}' mongodb://localhost:27017
I’d rather do it all through a nodejs script instead since I’m also planning on using it to check whether mongod is ready for connections or not.
Thanks in advance