DDD - How to store aggregates in NoSql databases

Viewed 5255

A current project needs us to persist domain objects in a NoSQL database such as mongoDB. In many examples (incl. Eric Evans, Vaughn Vernon) the domain objects are serialized and persisted to the mongoDB directly.

We would like to avoid mixing the domain layer with persistence related inforamtion by not having any annotations in our domain objects. Also we are concerned about corrupting the persisted data by changing the domain object in the future.

We came to the conclusion that we need to have some kind of DTOs translating between the domain objects and the persisted data.

Did anyone of you come across a good solution for such a case?

4 Answers
Related