我使用以下脚本来拆分和计算 MongoDB 中字符列中的数据。null
处理值时出现错误。请帮助我。
map = function() {
var array = this.characters.split(',');
emit(this.characters, array.length);
}
reduce = function(key, values) {
return values[0];
}
result = db.runCommand({
"mapreduce" : "book",
"map" : map,
"reduce" : reduce,
"out" : "comma_result1"
});
我收到此错误:
"errmsg" : "exception: map invoke failed: JS Error: TypeError: this.characters has no properties nofile_b:1"