| First of all, we were talking about validation of data in the database, specifically. > 'validation' generally implies aspects which are inherently application specific Not at all. Taking this at face value implies that some app can write data to the database that is valid according to that app, and then another app can read data that is invalid from its perspective, and have to deal with it. That doesn't make sense - data is data, it's either valid, or it's not. That's why the schema is about the data, not about the app. > Validation in almost every case must be done on the app layer For UX reasons, mostly, yes. But it's usually much more basic than what e.g. triggers would do in the DB itself. I'm not saying that there's nothing to validate outside of the DB, either. But for the data that is in the DB, the DB itself can usually do a better job. |
Disclaimer: MongoDB employee. All opinions are my own.