3 ms·
I think it's schemas in the sense that you start enforcing some rules at the database level for your JSON/BSON/JSONB data, instead of relying on ORMs. Defining
by nevi-me 11y ago
I think it's schemas in the sense that you start enforcing some rules at the database level for your JSON/BSON/JSONB data, instead of relying on ORMs.
Defining schemas at an ORM-level means that you always have to replicate that schema (as far as you need to write back to the DB) on every project that uses the data in the database.
The JSON storage route has been flexible, and I would assume that most people who use Mongo have some form of schema, even if it's very flexible. For example, a lot of my schema definitions look like:
{
field1: String,
field2 : {}
}
where field2: {} means I can pretty much dump anything in there.
I presume (without yet testing) that by 'schema' I'd still be able to do the above, except that I'll enforce field1 to be a String and still remain 'schema-less'/loose on field2