Couchdb multiple databases

couchdbdatabase

I'm used to working with mysql but for my next series of projects CouchDB (NoSQL) seems to be the way to go, basically to avoid EAV in mysql and to embrace all the cool features it has to offer.

After lots of investigation and reading documentation etc, there is one thing I don't seem to understand quite well.

Lets assume I host three web applications on my server and thus need three databases accordingly. For instance one is a webshop with product and invoice tables, one is a weblog with article and comment tables and another one is a web based game with game stats tables (simplification obviously).

So I host multiple sites on one installation of mysql, and each application I run on my server gets its own database with tables, fields and content.

Now, with CouchDb I want do the exact same thing. The problem seems to be that creating a database in CouchDb, is more similar to creating a table in mysql. I.e. I create databases called 'comments', 'articles' etc. for my weblog and inside I create a document per article or a document per comment.

So my question is: how can I separate my data from multiple web applications on one CouchDB installation?

I think I am doing something fundamentally wrong here but hopefully one of you guys can help me get on the right track.

Best Answer

In CouchDB, there's no explicit need to separate unrelated data into multiple databases. If you've constructed your documents and views correctly, only relevant data will appear in your queries.

If you do decide to separate your data into separate databases, simply create a new database.

$ curl -X PUT http://localhost:5984/somedb
{"ok":true}
Related Topic