Complete the code to set the write concern to acknowledge writes on the primary only.
db.collection.insertOne({name: "Alice"}, {writeConcern: {w: [1])Setting w: 1 means the write is acknowledged by the primary only.
Complete the code to set the write concern to require acknowledgment from the majority of replica set members.
db.collection.insertOne({name: "Bob"}, {writeConcern: {w: [1])Setting w: 'majority' ensures the write is acknowledged by most nodes in the replica set.
Fix the error in the write concern option to wait for acknowledgment from two nodes.
db.collection.insertOne({name: "Carol"}, {writeConcern: {w: [1])The value 2 means the write must be acknowledged by two nodes. It must be a number, not a string.
Fill both blanks to set write concern to wait for majority acknowledgment and a timeout of 5000 milliseconds.
db.collection.insertOne({name: "Dave"}, {writeConcern: {w: [1], wtimeout: [2])Setting w: 'majority' waits for most nodes, and wtimeout: 5000 sets a 5-second timeout.
Fill all three blanks to set write concern to wait for 3 nodes, enable journaling, and set a timeout of 2000 milliseconds.
db.collection.insertOne({name: "Eve"}, {writeConcern: {w: [1], j: [2], wtimeout: [3])Setting w: 3 waits for three nodes, j: true enables journaling, and wtimeout: 2000 sets a 2-second timeout.