我正在尝试使用 map reduce 将用户的业务评级汇总到一个集合中。
mapper = Code("""
function(){
var userID = this.user_id;
var business = this.business_id;
var rating = this.stars;
emit(userId, {business_id: business, stars: rating});
""")
reducer = Code("""
function(key, values){
var results = new Object();
results.values = values;
return results;
我希望得到 {u'_id': u'--65q1FpAL_UQtVZ2PTGew', u'value': {business: rating}, {business: rating}}
但我得到的是 {u'_id': u'--65q1FpAL_UQtVZ2PTGew', u'value': [u'values':[[u'values':[ u'values': [{business: rating} ,{业务:评级}...
如何从输出中删除所有额外的“值”标签?