Reputation: 1214
On an existing project to workaround the fact that MongoDB doesn't have transactions and for concurrent modifications across multiple collections by an application on multiple servers there is a workaround using a distributed cache (Infinispan) that handle locks. I know that we should design the database in some way to avoid this problem but sometime there is no other way, so I wonder if some people have found other ways to deal with this problem without requiring q distributed cache.
Upvotes: 0
Views: 27
Reputation: 11132
Assuming that option 1 and 2 are not applicable to your application now (because these are more up-front considerations), you should aim for option 3. For example by serving the content of each collection with a dedicated service and map the status of the "transaction" in the http codes (i.e. not-found, moved, modified etc) or just display incomplete information and push updates as soon as the transaction is complete etc.
Upvotes: 1