次のスクリプトを使用して、フィールド(mongodb)のコンマ区切り値のデータ数を分割してカウントしました。しかし、私の場合、この "" のような null 値があります。これには "errmsg" が表示されます: "exception: reduce -> multiple not supported yet",(このエラー)。値が null でない場合は、適切に機能します。この [characters:""] のように列に null 値がある場合は、それを機能させる必要があります。親切に助けてください。
エラー: "errmsg": "例外: reduce -> 複数はまだサポートされていません"、"code": 10075、"ok": 0
enter code here
map = function() {
var array = this.characters.split(',');
emit(this.characters, array.length);
}
reduce = function(key, values) {
return values;
}
result = db.runCommand({
"mapreduce" : "book",
"map" : map,
"reduce" : reduce,
"out" : "comma_result"
});`