MongoDB - SPLessons

MongoDB Consistency

Home > Lesson > Chapter 7
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

MongoDB Consistency

MongoDB Consistency

shape Description

MongoDB Consistency is one of the most important topic in mongoDB database. MongoDB Consistency represents the guarantees features of MongoDB, if there doesn't exists any new updates for creating the mention commodity, then each  and every accesses to that article and  will give back the last upgraded esteems. This segment depicts the components accommodated consequent in MongoDB Consistency. The MongoDB database consistency consists of 2 types, they are:

Consistency Monotonic Reads

shape Description

In mongoDB,the scenario for single database consists of two observers P and Q, and there documents with a value x equal to 123.At some point, P decide to update that document, by assigning 789 to x. And during the update, Q's observation can either be the record just before P made the update, the meaning 123, or just after if it waited for the lock to be released.

shape Conceptual figure

Consistency for Multiple Servers

shape Description

These are termed as eventual consistency. And eventually this document will make it over to the secondary database. And can choose the consistency and durability of a model that support MongoDB database and the difference between durability and consistency in the context of eventual consistency. Durability is about whether the data was persisted to durable media before control was returned. Eventual consistency in a replica set has a document that are composed to each and every servers, to the primaries and secondaries before the control was returned to the application. For completing the application before control is return to the application, issue an update command or a write command to the primary and control is not returned to document and if all the process work properly then the durable and constant undergo properly. MongoDB will take that update and apply it to the primary,replicate it to the secondaries and so on every thing will be consistent.There is a slight chance, however,if a primary fails before before the document has been made durable on the disk and that record will be lost. MongoDB then continues and replicates to the rest of the secondaries, but the control has already been returned to the application.

Summary

shape Key Points

  • MongoDB Consistency - Represents the guarantee feature of MongoDB.
  • Consistency Monotonic Reads - Provides a standalone mongod instance.
  • Consistency for Multiple Servers - Termed as eventual consistency.