问题
Exple :
I have a result like this
Result1 AFTER EMIT:
Key-------------------------------value
"2014/10/31" ----------------- {"A":a}
"2014/10/31" ----------------- {"B":b}
"2014/10/31"----------------- {"C":c}
"2014/10/31"----------------- {"D":d}
How can I output this new result from the previous one:
Key-------------------------value
"2014/10/31" -----------------{"Array":["A":a, "B":b, "C":c, "D":d]}
Is there a way? Any help will be appreciated. Thanks
回答1:
You can use Couchbase v3 new N1QL query language for that. Also there is Query Language Tutorial. Specifically Array Comprehensions syntax.
回答2:
I found it . Just do : group = true in the path or select it from the filter result . and a reduce function to return all the values from the map. also you can add the start key = "2014/10/31" and end key= "2014/10/31".
来源:https://stackoverflow.com/questions/26681234/how-can-i-groupby-and-change-content-of-the-value-in-couchbase