Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB Spring Pessimistic Lock

I'm trying to implement a Pessimistic lock on my Spring Boot application running with a MongoDB instance.

The problem:

User A, select the Document ID 123 User A, update the Document, append one field and Save it User B, select the Document ID 123 and need to wait User A finish the Save.

Is it possible do with MongoDB?!

like image 381
Rafael Bandeira Rodrigues Avatar asked Mar 26 '26 09:03

Rafael Bandeira Rodrigues


1 Answers

I've found this post. On my tests, it looks like solve the problem.

But the Best approach is to use WebFlux with Mongo. Unfortunately, it's not possible on the project I'm running at this moment

like image 166
Rafael Bandeira Rodrigues Avatar answered Apr 02 '26 22:04

Rafael Bandeira Rodrigues