incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Cohen <cohen....@gmail.com>
Subject 'Grouping' documents so that a set of documents is passed to the view function
Date Fri, 19 Jun 2009 03:48:22 GMT
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 	

Mime
View raw message