Hi:
I'm really a newbie, and I have a newbie problem (and maybe a miss
conception of the way to work with couch).
I have a lot of documents with this form (that represents experiments with
any number of conditions, so X and Y could be only X or even X,Y,Z...)
{
"Experiment":"something",
"Conditions":
{
"X":3,
"Y":2
}
}
And I have a view like:
MAP:
function(doc) {
if (doc.Experiment)
for (i in doc.Conditions){
emit(doc.Experiment, i);
}
}
REDUCE:
function(key,values)
{
return values;
}
When I launch the view I get this:
{"rows":[{"key":"Something","value":["X","Y"]},{"key":"Something2","value":["X","Y","X","Y","X","Y","Z","X","Y","X","Y","X","Y","Z"]}]}
I would like to get what are the conditions for every experiment grouped by
experiment without repetitions (I mean something like)
{"rows":[{"key":"Something","value":["X","Y"]},{"key":"Something2","value":["X","Y","Z"]}]}
Anyone could help me?
Regards from Canary Island
Manuel Padron Martinez