Which statement best describes causal consistency in MongoDB?
Think about how related changes should appear in order to maintain logical flow.
Causal consistency ensures that if one operation depends on another, all clients see them in that order. Unrelated operations may appear in different orders.
Given a MongoDB replica set with causal consistency enabled, if a client writes a document and then reads it immediately, what will the read operation return?
Consider what causal consistency guarantees about visibility of your own writes.
Causal consistency guarantees that a client will always see its own writes immediately on subsequent reads.
Which of the following code snippets correctly enables causal consistency for a MongoDB session in Node.js?
const session = client.startSession({ /* options here */ });
Check the exact option name for enabling causal consistency in the MongoDB Node.js driver.
The correct option name is causalConsistency with camelCase and boolean true.
When using causal consistency in MongoDB, which read preference setting optimizes for reading your own writes while allowing reads from secondary replicas?
Think about a setting that prefers primary but can fall back to secondary.
primaryPreferred allows reading from the primary to see your writes but can read from secondaries if primary is unavailable.
You observe that a client sometimes reads stale data that does not reflect its previous writes, despite using causal consistency sessions. Which is the most likely cause?
Consider how sessions relate to causal consistency guarantees.
Causal consistency requires using the same session for related operations to maintain order and visibility.