Where does mongodb stand in the CAP theorem?

后端 未结 8 2101
鱼传尺愫
鱼传尺愫 2020-11-28 18:15

Everywhere I look, I see that MongoDB is CP. But when I dig in I see it is eventually consistent. Is it CP when you use safe=true? If so, does that mean that when I write wi

8条回答
  •  再見小時候
    2020-11-28 19:11

    Mongodb never allows write to secondary. It allows optional reads from secondary but not writes. So if your primary goes down, you can't write till a secondary becomes primary again. That is how, you sacrifice High Availability in CAP theorem. By keeping your reads only from primary you can have strong consistency.

提交回复
热议问题