I am trying to learn CQRS in my spare time. Say I have a class like this:

public class Person
  private Guid Id {get; set;}
  private Guid Name {get; set;}
  private List<Order> orders;

  //Methods and constructor go here


I am thinking of a scenario where it would be beneficial to persist the Person class to the write database (SQL Server) and then the person and order class to the read database (Mongodb).

The only reason I need to persist the Person class on the write side is to benefit from change tracking.

Is it normal for the write database to have different fields to the read database i.e. in this case orders are not persisted on the write side. Or should the same classes and fields be persisted on both sides?

I realise that relational databases are different to NoSQL databases and both have their benefits and limitrations. I am specifically asking if it is normal for information to be available in the read database that is not available in the write database.

I realise the answer to my question is yes; from a technical point of view. I am asking when thinking about the principle of least astonishment.


Normally I would expect the changes you write to the Write side to eventually make their way over to the Read side.

With the same DB make and structure on both sides you can see how this is easily achieved with built in replication technologies. To the outside observer it looks like a single database, you are just cleverly optimising it.

If you used different databases for each side its unclear how you would sync the two up.

Additonally if one has extra information that the others structure doesn't have a place for. Then you cant both read and write that info without breaking the pattern. You would end up with two versions of your data and which one was authorative might become an open question.

As you say, techincally possible, but you would have to see the whole solution to see if it worked nicely and made an overall improvement.

  • Thanks. The read side synchronises with the write side using a message queue. There is also an event log on the write side, which contains all the data the read side needs. Therefore the only benefit of the write model is for change tracking one of the entities. Does that make sense? – w0051977 Jan 11 at 9:19

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.