1
我正在使用couchbase 3.0並玩弄啤酒樣本數據。Reduce不算密鑰
我已創建地圖的存在的圖:
function (doc, meta) {
if (doc.category && doc.abv) {
emit(doc.category, doc.abv);
}
}
這得到以下輸出:
{"total_rows":2397,"rows":[
{"id":"21st_amendment_brewery_cafe-watermelon_wheat","key":"Belgian and French Ale","value":5.5},
{"id":"3_fonteinen_brouwerij_ambachtelijke_geuzestekerij-drie_fonteinen_kriek","key":"Belgian and French Ale","value":5},
{"id":"3_fonteinen_brouwerij_ambachtelijke_geuzestekerij-oude_geuze","key":"Belgian and French Ale","value":6},
{"id":"512_brewing_company-512_wit","key":"Belgian and French Ale","value":5.2},
{"id":"512_brewing_company-one","key":"Belgian and French Ale","value":8},
{"id":"abbaye_de_maredsous-10","key":"Belgian and French Ale","value":10},
{"id":"abbaye_de_maredsous-8","key":"Belgian and French Ale","value":8},
{"id":"abbaye_notre_dame_du_st_remy-rochefort_10","key":"Belgian and French Ale","value":11.3},
{"id":"abita_brewing_company-satsuma_harvest_wit","key":"Belgian and French Ale","value":5.1},
{"id":"affligem_brouwerij-affligem_dubbel","key":"Belgian and French Ale","value":6.8}
]
}
當選擇頂部10
現在我想計數每個類別的啤酒數量。所以我決定添加內建的減少_count
。
不幸的是輸出沒有預期的一個,而是:
{"rows":[
{"key":null,"value":2397}
]
}
爲什麼我有鑰匙設置爲null,而不是作爲doc.category
?