How can I groupBy and change content of the value in couchbase?

a 夏天 提交于 2020-01-03 05:08:20

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!