0
0
MongoDBquery~5 mins

Write concern and data durability in MongoDB - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is write concern in MongoDB?
Write concern is a setting that tells MongoDB how sure it should be that a write operation has been saved before reporting success.
Click to reveal answer
beginner
What does w: 1 mean in MongoDB write concern?
It means the write operation must be acknowledged by the primary server only before reporting success.
Click to reveal answer
intermediate
How does w: 'majority' affect data durability?
It ensures the write is confirmed by the majority of replica set members, increasing data safety in case of failure.
Click to reveal answer
intermediate
What is the role of j: true in write concern?
It requires the write to be committed to the journal on disk, improving durability by protecting against power loss.
Click to reveal answer
advanced
Why might you choose a lower write concern like w: 0?
To improve performance by not waiting for any acknowledgment, but this risks losing data if the write fails.
Click to reveal answer
What does write concern control in MongoDB?
AHow many servers confirm a write before success
BThe speed of the query execution
CThe size of the database
DThe number of indexes
What does w: 'majority' ensure?
AWrite is confirmed by the primary only
BWrite is confirmed by most members in the replica set
CWrite is confirmed by all members
DWrite is not confirmed at all
What does setting j: true do?
ADisables journaling
BDeletes journal files
CSpeeds up writes by skipping disk
DRequires write to be saved to journal on disk
Which write concern gives no acknowledgment of write success?
Aw: 0
Bw: 1
Cw: majority
Dj: true
Why is a higher write concern better for data durability?
AIt deletes old data
BIt makes writes faster
CIt confirms writes on more servers, reducing data loss risk
DIt compresses data
Explain what write concern is and how it affects data durability in MongoDB.
Think about how many servers must say 'I saved it' before you trust the write.
You got /3 concepts.
    Describe the difference between w: 1, w: majority, and w: 0 write concerns.
    Consider how many confirmations each setting requires.
    You got /3 concepts.