Complete the code to set write concern to acknowledge writes by 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 write concern to wait for majority of nodes to acknowledge.
db.collection.updateOne({_id: 1}, {$set: {score: 100}}, {writeConcern: {w: [1])Using w: 'majority' waits for most nodes to confirm the write.
Fix the error in the write concern option to correctly wait for majority acknowledgment.
db.collection.deleteOne({_id: 5}, {writeConcern: {w: [1])The write concern value 'majority' must be lowercase string exactly.
Fill both blanks to set write concern to acknowledge by primary and timeout after 5000ms.
db.collection.insertMany(docs, {writeConcern: {w: [1], wtimeout: [2])Setting w: 1 waits for primary acknowledgment and wtimeout: 5000 sets 5 seconds timeout.
Fill all three blanks to set write concern to majority, timeout 2000ms, and journal enabled.
db.collection.updateMany(filter, update, {writeConcern: {w: [1], wtimeout: [2], j: [3])Using w: 'majority' waits for majority, wtimeout: 2000 sets 2 seconds timeout, and j: true enables journaling.