I’ve just started playing around with couchdb and I’m really liking it so far, but I was wondering when you should be creating a new database.
Here’s what I mean:
If i were to create a blog on a server with multiple blogs and this was a RDBMS, I’d create a database called fox_blog and create tables and relations for the posts, comments, etc..
Now in CouchDB, I’d simply make 3 document types: posts, comments and user accounts.
But this is my question: Would I make one db called fox_blog and add a ‘type’ field to each of the documents (e.g., in the posts documents there would be a ‘type’ field with the value of ‘post’)? Or would I make a separate db for each document and precede the name with fox_ (e.g., db name would be fox_posts for the posts)? Or are neither of these correct?
Let me know if any of this is unclear, it was a bit hard to explain heh
Generally, I try to keep separate applications in each of their own database. In this case, if all the varying blogs are accessed within a single interface, keep it in 1 database, using fields like
typeandblogto identify each document.If you are running multiple blogs, each accessed at their own domain or address, you may want to consider segmenting each of the blogs into their own database. Basically, CouchDB allows you a great deal of flexibility here, so take advantage of that and experiment.