MongoDB Safe Mode Consistency

Help me understand what level of consistency I can expect in MongoDB in this situation.

We are executing a replica set with a flag consistency

in Mongoid set to strong

, which means the read only goes to the master. But the safe

default configuration uses a value false

, so write operations return immediately.

Assuming there are no errors, if the client application inserts a new large document and then quickly tries to read it on a different thread, are we guaranteed to get the document back? Or do we need to enable the mode safe

to ensure a level of consistency?

+3


source to share


1 answer


If you write and then read from the primary, you won't always get a consistent result. It doesn't matter if you are in the same connection or not. If you are using the same connection, you don't need to securely. If you are using not on the same connection, you need to securely.



+3


source







All Articles