次のスクリプトを使用して、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"