mongo-sync icon indicating copy to clipboard operation
mongo-sync copied to clipboard

Replica set issues

Open chhib opened this issue 11 years ago • 1 comments

I am trying to make the Server take arguments with replica set members by extending options such as:

this._server = new mongodb.Server(host, port, { ...
  readPreference: 'primaryPreferred'
}

I do get this error though:

MongoError: not master or secondary; cannot currently read from this replSet member

Any ideas how to make this work?

chhib avatar Sep 17 '14 09:09 chhib

The options objects is currently ignored. I can update this to work as you described next week.

If you want to try it yourself: fork mongo-sync and update the constructor to accept a third parameter which is the options object. If that is present, then use it instead of the default arguments: https://github.com/olegp/mongo-sync/blob/master/lib/mongo-sync.js

olegp avatar Sep 19 '14 04:09 olegp