I wasn’t sure if this is the correct section to post this in, so apologies if it’s wrong here.
After updating to Node js driver 3.6.3 some errors occur to our logs:
[ERROR] MongoError: not master and slaveOk=false
This error occurs daily in logs.
The configuration for connection is set with: " “readPreference”: “secondaryPreferred”,".
I am not sure if it is due to node.js driver upgrade or we have some other problems. But we inspect mongo logs and it does not have any failover or other similar issues.
Until now, we do not have this kind of logs.
It looks like you client is connected directly to a secondary. You have to specify the replica set name on the URI so that the client automatically detect and use the primary.
The root cause of the issue is https://jira.mongodb.org/browse/NODE-3129
It seems to reproduce with the driver version 3.6.10.
A tested workaround is:
await incidentCollection.find({“_id”: ID}, {limit: 1, readPreference : “primary”}).next()