Saturday, August 07, 2010

Schema-less data and strongly-typed objects

There has been some talk on the NoSQL grapevine recently about schema-mapping and the associated issues when dealing with schema-less data stores (specifically document-databases).

To my mind the core problem is not that it’s difficult to control the schema – that, after all, is the point, but instead by the use of statically-typed languages to access the contents. Deserializing documents back into strongly-typed binary objects will cause a problem if the structure of the documents changes. Deserializing JSON back into JavaScript objects doesn’t suffer from this problem.

It then becomes a client-side issue of understanding what to do with an object when it doesn’t have the property you’re looking for. This is a great example of why you should consider the use of NoSQL data stores carefully – caveat emptor is the guiding principal.

(Here’s an example of the sort of thing going on to mitigate such problems - – and yes, I do know that MongoDB uses BSON, not JSON – I’m just illustrating the point.)

No comments: