Answer the question
In order to leave comments, you need to log in
How to do similar in mongodb?
Good afternoon!
Please tell me how to implement this in mongodb:
locking a key, reading a key, checking the value of a key, possibly changing a key, unlocking a key.
when the connection is broken, the lock is released.
I need to get behavior similar to postgresql behavior: begin; select for update; update; commit;
I need to eliminate the race condition when changing the value of a key.
is this at all possible to do in mongodb?
findAndModify() is not suitable because it is possible that we execute a request and do not receive a response or fall off
Answer the question
In order to leave comments, you need to log in
you want a transaction - there are none in monge.
but you can do it like this
findAndModify() is not suitable because it is possible that we execute a request and do not receive a response or fall offYou will definitely get an answer if everything went smoothly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question