I have 2 mongo instance running in 2 different servers (one primary and other secondary); I am able to retrieve a document from the primary server using this connection code:
var db = mongojs('user:pswd@localhost:27017/mydb?authSource=admin');
But when I try to retrieve a document from the secondary server, I am getting the following error:
{ [MongoError: not master and slaveOk=false]
name: 'MongoError',
message: 'not master and slaveOk=false',
ok: 0,
errmsg: 'not master and slaveOk=false',
code: 13435 }
I also tried using the code:
var db = mongojs('user:pswd@localhost:27017/mydb?authSource=admin&slaveOk=true');
What am I missing?