Massive CouchDB Brain Dump
blog.mattwoodward.com
blog.mattwoodward.com
For me the scary part is that I usually do care. How do you stop caring about this? Doesn't this mean your application code starts to get populated with if/then/else? Is there a best-practice for backfilling data when the (effective) schema changes?
If I was using couchdb I would assume that all but the most fundamental fields were optional and have the application act accordingly.
As an example of what I mean, there are some places where you can simplify by knowing that a relationship is 1:1 instead of 1:n because based on the current schema it's impossible for it not to be 1:1. You don't need an if/then or any logic in your application when you access that field.
This means if you want to make it 1:n you have to change the schema and deal with all of the code that will break due to that change. Once that is done, then your application can input lists of items into the storage.
In the document oriented approach, is seems like you (or any code touching the document type) just start inputting lists. This makes changing the schema a non-issue. It is up to the code pulling data to always assume the data could be null, single or a list of items.
In the couchDB model it seems the schema is implicitly defined by the behavior of the application. I don't really know what that means for the application. I'm sure the tradeoff is worth it in a lot of cases, I'm just saying that this is one of the parts where my imagination is failing me and the unknown-unknowns are great.
It seems like here the skills of writing a great REST API are more relevant than traditional data modeling skills.
Couch is interesting in a way, but I feel like the set of problems that fit it well is far smaller than Mongo's. (and that that set is far smaller than SQL still, but that's another matter)
Mongo is also way way faster, though the API isn't as 'cute' by far. I feel like the great web UI for couch, along with their heavy javascript/json usage is the main reason it gets so much traction.
There is one thing that couch does to better than mongo, and thats single server durability. You can pretty much kill -9 couch and it won't care (that's pretty much how it stops itself).
Now, I understand mongodb's stance on why you should be running multiple servers for your high performance app, but for a lot of apps that don't need HA that's just overkill and a pain to configure (and extra $$$ for more hardware). In fact, I'd go so far as to say thats the case for most apps. If I recall they're working on it at the moment though.