How to use transactions over multiple databases #9882
-
Basically I am creating a reference of one user on two differenct dabases hosted at different places. I want to save the reference in one database if and only if the user was saved on the other database. Is there a way to shared one mongoose session over two different dabases? I am using axios library to connect between two node.js hosted servers |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Unfortunately not, MongoDB doesn't support transactions across separate database clusters. You'd have to implement a transaction yourself using something like this: https://www.docs4dev.com/docs/en/mongodb/v3.6/reference/tutorial-perform-two-phase-commits.html |
Beta Was this translation helpful? Give feedback.
Unfortunately not, MongoDB doesn't support transactions across separate database clusters. You'd have to implement a transaction yourself using something like this: https://www.docs4dev.com/docs/en/mongodb/v3.6/reference/tutorial-perform-two-phase-commits.html