Grokking MongoDB
0% completed
Replica Set Read and Write Semantics
A write can return success and still disappear. We proved this on a three-member set by stopping both secondaries, then writing to the primary, which had not yet noticed the problem:
db.users.insertOne({ name: "Helen", age: 29 }, { writeConcern: { w: 1 } }) // { acknowledged: true, insertedId: ObjectId('6ae75796a0f9610245cb0ce2') }
We then killed that primary and restarted the two secondaries, and they elected a new primary without Helen. They accepted new writes
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%