public MapReduce Execute()
{
if(cmd.Contains("map") == false || cmd.Contains("reduce") == false){
throw new InvalidOperationException("Cannot execute without a map and reduce function");
}
canModify = false;
try{
result = new MapReduce.MapReduceResult(db.SendCommand(cmd));
}catch(MongoCommandException mce){
result = new MapReduce.MapReduceResult(mce.Error);
throw new MongoMapReduceException(mce, this);
}
return this;
}
public void TestExecuteSimple() { MapReduce mr = mrcol.MapReduce(); mr.Map = new Code(mapfunction); mr.Reduce = new Code(reducefunction); mr.Execute(); Assert.IsNotNull(mr.Result); }