Are there APIs available for working on multiple databases ?
Here is the use case/data model:
* a CouchDB database for one project
all project related documents are stored in the DB.
* a user can participate in multiple projects
let's say a user wants to display a list of his documents in all projects, how do we support this ? Do I have to issue one query command for each database then aggregate the result ?
thanks
canal
--
Sincerely yours,
Nadav
The CouchDB-Lounge project has a query merging proxy which could be
adapted for this purpose.
> On Tue, Sep 22, 2009 at 7:51 PM, go canal <goc...@yahoo.com> wrote:
>
>> Hello,
>> I am only one-day 'old' in the Couch world, CouchDB is really cool :-)
>> I have a lot of questions though, sorry if these had been already
>> answered...
>>
>> Are there APIs available for working on multiple databases ?
>>
>> Here is the use case/data model:
>> * a CouchDB database for one project
>> all project related documents are stored in the DB.
>> * a user can participate in multiple projects
>>
>> let's say a user wants to display a list of his documents in all projects,
>> how do we support this ? Do I have to issue one query command for each
>> database then aggregate the result ?
>>
>> thanks
>> canal
>>
>>
>>
>>
>
>
>
>
> --
> Sincerely yours,
> Nadav
>
--
Chris Anderson
http://jchrisa.net
http://couch.io
I agree that the use case is application specific; however, I tend to think that the data model is actually generic.
I do not know the design intent of a 'database' in CouchDB. For performance reason, and/or other something else. But I thought that since we have an API for getting all DBs, we might have something else for developers to manage a groups DBs.
rgds,
canal
________________________________
From: Nadav Samet <thes...@gmail.com>
To: us...@couchdb.apache.org
Sent: Wednesday, September 23, 2009 11:03:58 AM
Subject: Re: how to work on multiple databases
Is there a plan to merge this into CouchDB core ?
rgds,
canal
________________________________
From: Chris Anderson <jch...@apache.org>
To: us...@couchdb.apache.org
Sent: Wednesday, September 23, 2009 1:29:36 PM
Subject: Re: how to work on multiple databases
On Tue, Sep 22, 2009 at 8:03 PM, Nadav Samet <thes...@gmail.com> wrote:
> thanks.
> I quickly google, saw two lounge projects. guess this one is for the
> partitioning solution ? That's very good, I am about to ask this
> feature .....
>
> Is there a plan to merge this into CouchDB core ?
Yes, CouchDB will definitely have partitioning, either via Lounge or
an all-Erlang solution. Best,
Adam
________________________________
From: Adam Kocoloski <koco...@apache.org>
To: us...@couchdb.apache.org
Sent: Wednesday, September 23, 2009 7:42:01 PM
Subject: Re: how to work on multiple databases
On Sep 23, 2009, at 5:55 AM, go canal wrote:
I contributed a change to CouchRest which lets you do
Foo.on(database).whatever
which directs your request to a database dynamically.
I haven't tested this in a while - I found CouchRest too complex internally
so I ended up knocking together my own API (couchtiny). I published it on
github.com/candlerb, although it's subject to change at my own whim :-)
> let's say a user wants to display a list of his documents in all projects,
> how do we support this ? Do I have to issue one query command for each
> database then aggregate the result ?
Yes. For me it's a feature, rather than a bug, that couchdb databases are
completely isolated from each other. Maybe you should consider lumping
everything into one database.
Regards,
Brian.
>> I can understand that couchdb DBs are completely isolated, I also agree that logically it is ok. But since there is no other layer we can use within a DB for modeling, I think operations on multiple databases are desired.
It does seem that putting something I need into one DB is the only way. Maybe it is acceptable since couchdb works incrementally, so performance won't be a problem even there is a large number of records because of combining multiple DBs into one ....
rgds,
canal
You could create an external indexer that collects results from all
project databases.
Regards,
Sven
1) store the docs from different projects in the same db and use a
view to sort them via project
2) same but pack the project name and user into the _id field and use
the prebuilt _all_docs view to sort them via project/user
3) you can always combine db's using replication if you choose to
aggregate at a later point in time.
Happy to follow up offline if you have more questions.
-Mike