Friday, August 25, 2017

Aggregate Grouping With N1QL or With MapReduce

DZone Database Zone
Aggregate Grouping With N1QL or With MapReduce

"Aggregate grouping" is what I’m putting in the title of this blog post, but I don’t know if that’s the best name. Have you ever used MySQL’s GROUP_CONCAT function or the  FOR XML PATH('') workaround in SQL Server? That’s basically what I’m writing about today. With Couchbase Server, the easiest way to do it is with N1QL’s ARRAY_AGG function, but you can also do it with an old school MapReduce View.

I’m writing this post because one of our solution engineers was working on this problem for a customer (who will go unnamed). Neither of us could find a blog post like this with the answer, so after we worked together to come up with a solution, I decided I would blog about it for my future self (which is pretty much the main reason I blog anything, really; the other reason is to find out if anyone else knows a better way).

No comments:

Fun With SQL: Functions in Postgres

DZone Database Zone Fun With SQL: Functions in Postgres In our previous  Fun with SQL  post on the  Citus Data  blog, we covered w...