Reputation: 1862
I have a project using the CQRS design pattern with domain driven design. In the read side of this project, I use a materialized view to build the read model so that read side and write side can be updated to be consistent by SQL Server.
I would like to refactor my project and use MongoDB for the read side. I don`t know much about MongoDB. Is there any algorithm or strategy to keep data consistent between a NoSQL database (MongoDB) and a relational database (SQL Server)?
Upvotes: 1
Views: 1230
Reputation: 1817
To synchronize data storages your queries (read side) and commands (write side) you can use one of the following strategies:
So, it's up to you to figure out what strategy best applies to your project.
Only with synchronous approach you got strong consistency. Other options causes eventual consistency and they differ how much long the data could be stale. In asynchronous approach you have stale data in terms of milliseconds.
Upvotes: 3