Mongo DB

 How can we handle optimistic locking in Mango DB?

  • In Mango DB, we have versions associated with each record of the table.
  • If 3 threads are trying to update our record and one third updates it Remaining 2 will have older or stale versions.
  • As soon as they try to update the table with old version, it throws an optimistic lock exception.
  • Using retryable, we can fetch the data of latest version And update latest data.

Comments

Popular posts from this blog

General DB Questions

Query Questions