Recall & Review
beginner
What is write concern in MongoDB?
Write concern is a setting that controls the level of acknowledgment requested from MongoDB when performing write operations. It tells MongoDB how sure you want to be that your data was saved.
Click to reveal answer
beginner
What does
w: 1 mean in write concern?It means the write operation must be acknowledged by the primary server only before reporting success. This is the default level.
Click to reveal answer
intermediate
What happens if you set
w: 'majority' in write concern?The write operation waits until a majority of replica set members have acknowledged the write. This increases data safety by ensuring replication.
Click to reveal answer
intermediate
What is the role of
wtimeout in write concern?It sets a time limit (in milliseconds) for how long MongoDB waits for the write concern to be satisfied. If the time expires, an error is returned.
Click to reveal answer
advanced
What does
w: 0 mean and when might it be used?It means no acknowledgment is requested from the server. The client does not wait for confirmation. It can be used for very fast writes where data loss is acceptable.
Click to reveal answer
What does write concern control in MongoDB?
✗ Incorrect
Write concern controls the level of acknowledgment from servers for write operations.
Which write concern value waits for acknowledgment from the primary only?
✗ Incorrect
w: 1 means acknowledgment from the primary server only.
What does setting
wtimeout do?✗ Incorrect
wtimeout sets a time limit for waiting for write concern acknowledgment.
If you want the fastest write without waiting for confirmation, which write concern do you use?
✗ Incorrect
w: 0 means no acknowledgment is requested, so writes are fastest but less safe.
What does
w: 'majority' ensure?✗ Incorrect
w: 'majority' waits for acknowledgment from most replica set members.
Explain what write concern is and why it matters in MongoDB.
Think about how sure you want to be that your data is saved.
You got /3 concepts.
Describe the differences between write concern values w: 0, w: 1, and w: majority.
Consider how many servers confirm the write.
You got /4 concepts.