Best way to update 2 collections at once


#1

Hey guys,

I am updating my user collection and post collection in a single method. I am a bit concerned with the atomicy of it all in mongodb. Does anyone know best practices when doing such a thing?

(Is a two-phase commit the best that can be done?)

Thanks.


#2

There’s no need to worry about this. Each update will run sequentially in the same method call.