Any help on this?
Hi,
I was able to successfully insert, update, and delete a document using the secondaryPreferred
readPreference using MongoDB 3.2.6 and node.js driver 2.1.19:
var MongoClient = require('mongodb').MongoClient
var assert = require('assert')
MongoClient.connect('mongodb://localhost:27017,localhost:27018,localhost:27019', {db: {readPreference: 'secondaryPreferred'}} , function(err,db){
assert.equal(null,err,err)
var coll = db.db('test').collection('test')
coll.insert({x:1}, function(err,res){
assert.equal(null,err,'Insert: ' + err)
console.log('Insert successful')
})
coll.updateOne({x:1}, {$set: {x:2}}, function(err,res){
assert.equal(null,err,'Update: ' + err)
console.log('Update successful')
})
coll.deleteOne({x:2}, function(err,res){
assert.equal(null,err,'Delete: ' + err)
console.log('Delete successful')
})
})
If you are still having not master
issues, could you please post your MongoDB version and a code snippet that reproduces the issue?
Also please note that there was a recently-solved ticket that involves the not master
error when dropping a collection using secondaryPreferred
(NODE-716) that will be fixed in the upcoming node.js driver update.
Best regards,
Kevin