Are there any recommendations or approaches how to proceed with business unique constraint violation?
I tried to google here but didn’t find that someone discussed it already.
For example we have user profile aggregate and we should not allow to create several users with the same nick name, email address, real address or phone number?
Because it’s not part of aggregate unique identifier and we cannot query aggregate by such fields (and as far as I understand it’s actually not recommended)
I can see only one way to do it – create separate view and check it there, however it’s possible gap between new profile have been created and view is updated too.
Also for example for mongo, if we can keep even as json we can apply indexes in mongo (even unique constraint) for such fields but it’s vendor specific
and as far as I see current Mongo Event Store doesn’t store even message this way (please correct me if I’m wrong).
Would appreciate if someone will share their thoughts or experience.