私は mapreduce を理解して頭がおかしくなりました。だから、私はあなたに助けを求めます。
私はそのようなエンティティを持っています:
public class ConstraintSpec
{
[BsonId]
public int Id { get; set; }
public bool OrderRequired { get; set; }
public ActionTypeConstraintSpec[] ActionTypeConstraintSpecs { get; set; }
}
そして、IDジェネレーターを作成しようとしています。
これが私の「動作しない」MapReduce js コードです。
Map = "map = function () {" +
"emit(this._id)}";
Reduce = "reduce = function (key, values) {" +
"var max = this[0];" +
"var len = this.length;" +
"for (var i = 1; i < len; i++) if (this[i] > max) max = this[i];" +
"return max;" +
"}";
それから私は書いています:
var mapreduce = cont.MapReduce(Map, Reduce);
var x = mapreduce.GetResults();
しかし、何も機能しません。
助けてください!