Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
MAP products bought together in CouchDB and create facets via REDUCE
function(doc) {
if (doc.type === "sale") {
if (doc.register_sale_products && doc.register_sale_products.length>1) {
for (var i=0; i < doc.register_sale_products.length; i++) {
for (var j=0; j < doc.register_sale_products.length; j++) {
if (i != j) {
function(keys, values) {
return sum(values);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment