0
votes

A quick thought today, does CouchDB handle multiple collections of databases?

To explain what I mean, our web app has two types of users, free and commercial which differ greatly in their document and view structure. For all intents and purposes, they are completely different products. A database is created per customer, and contains all their particular data and settings.

Without going into too much needless info, we currently have a mix of commercial-based databases and free-based databases mixed together in one instance of CouchDB. From a purely organisational standpoint, it's quite messy to sift through the (currently 50) free-based databases to find the (currently 3) commercial-based databases. Is there a better way to organise or sort these?

Has anyone got any ideas? I know I could simply add prefixes to the databases, but was after a MySQL-type approach where creating a separate database would be possible.

2

2 Answers

0
votes

Other than grouping your data by using a property of each document (i.e. you put all of your free customers in the same db and prefix your views with that property) I don't think there's any way of grouping similar databases together aside from your suggestion of a prefix.

You could always consider running two instances, one for the free users and one for the paid ones.

0
votes

Why don't you add 2 more properties to your couchdb users document, like .instance and .type, where you could store within .type field 'FreeUserType' or 'PaidUserType' and in .instance field just write some 'ID' of your 'group/collection' this way u can query your users base in very complex way and it will be giving you a lot of flexibility in extending your db with more 'related' data objects that you could 'join' on queries.