Document databases are not schema less

This has become a little pet peeve of mine and it’s a bit of a rant. So be warned and exit now :).

I’m getting tired of people who are walking around saying that it’s so nice with document databases because you don’t need a schema. ”You can just insert whatever…”

My issue with this is that I feel they can never have maintained a solution like that.

The schema is always there but if it’s not in the database it’s in the code. I read somewhere that it can be called a on-read-schema (in opposite of a on-write-schema) which I think sums it up nicely.

I have a document database and I’m storing the full address in a field. Then we decide to split it up in street address, zip and city. I can directly start inserting it in that format but when I read the posts I need to put some logic in place to handle this (a schema that is).

if(entry.full_address && entry.full_address.lenght > 0) {
    street = getStreetFromFullAddress(entry.full_address);
    zip_code = getZipFromFullAddress(entry.full_address);
    city = getCityFromFullAddress(entry.full_address);
else {
    street = entry.street;
    zip_code =;
    city =;

That said. I think document databases are awesome, at certain things and less good at others. Use the right tool for the job man and for the right reasons!

Lämna ett svar

E-postadressen publiceras inte. Obligatoriska fält är märkta *

Denna webbplats använder Akismet för att minska skräppost. Lär dig hur din kommentardata bearbetas.