Big apologies for spamming the list -- I accidentally sent this email rather than another.
Cheers,
Ben

Begin forwarded message:

From: Ben Cohen <[email protected]>
Date: June 19, 2009 11:48:22 AM GMT+08:00
To: [email protected]
Subject: 'Grouping' documents so that a set of documents is passed to the view function

Is there anyway, or any known plan to add a way, to arrange for couchdb to pass multiple documents to a view function rather than just a single doc?

I've got an application where for a variety of reasons I cannot control the update method that various information sources use to get data into couchdb. This has the effect of breaking up information I would like to treat as a single document across a 'small' number (say 100) documents. I'd like to define some way for the 'relationship' between these documents to be 'discovered' by couchdb so that those 100ish documents are passed to my view function all at once.

eg say i have the documents:

{
"_id" : "doc_a",
"data" : "doc_a_data",
"group_key" : 1
},
{
"_id": "doc_b",
"data": "doc_b_data",
"group_key" : 1
}
{
"_id": "doc_c",
"data": "doc_c_data",
"group_key" : 2
}
{
"_id": "doc_d",
"data": "doc_d_data",
"group_key" : 2
}

It would be really cool if there were some way to pass all the docs with a value of 1 for group_key to a single map function call, so I could do computation across those related documents and emit the results ... I'm just using the magic group_key attribute as an example, if such a feature were to actually be made I'd think you'd define a javascript function which returned a single groupping k to exist I

Reply via email to