A fluent interface for executing a Map/Reduce call against a collection.
상속: IDisposable
예제 #1
0
        public void TestGetMapReduceObject()
        {
            MapReduce mr = mrcol.MapReduce();

            Assert.IsNotNull(mr);
            Assert.AreEqual(mrcol.Name, mr.Name);
        }
        public void TestBuilderSetsAllProperties()
        {
            Document         query = new Document().Append("x", 1);
            Document         scope = new Document().Append("y", 2);
            Document         sort  = new Document().Append("z", 3);
            MapReduceBuilder mrb   = mrcol.MapReduceBuilder();

            mrb.Map(mapfunction)
            .Reduce(reducefunction)
            .KeepTemp(true)
            .Limit(5)
            .Out("outtest")
            .Query(query)
            .Scope(scope)
            .Sort(sort)
            .Verbose(false);

            MapReduce mr = mrb.MapReduce;

            Assert.AreEqual(query.ToString(), mr.Query.ToString());
            Assert.AreEqual(scope.ToString(), mr.Scope.ToString());
            Assert.AreEqual(sort.ToString(), mr.Sort.ToString());
            Assert.AreEqual(true, mr.KeepTemp);
            Assert.AreEqual(5, mr.Limit);
            Assert.AreEqual("outtest", mr.Out);
            Assert.AreEqual(false, mr.Verbose);
        }
예제 #3
0
        public void TestExecuteSimple()
        {
            MapReduce mr = mrcol.MapReduce();

            mr.Map    = new Code(mapfunction);
            mr.Reduce = new Code(reducefunction);
            mr.Execute();
            Assert.IsNotNull(mr.Result);
        }
        public void TestCreateMapReduceWithStringFunctions()
        {
            MapReduce        mr  = mrcol.MapReduce();
            MapReduceBuilder mrb = new MapReduceBuilder(mr);

            mrb.Map(mapfunction).Reduce(reducefunction);

            Assert.IsNotNull(mr.Map);
            Assert.IsNotNull(mr.Reduce);
        }
        public void TestExecuteSimple()
        {
            MapReduceBuilder mrb = mrcol.MapReduceBuilder();
            MapReduce        mr  = mrb.Map(mapfunction).Reduce(reducefunction).Execute();

            Assert.IsNotNull(mr.Result);
            Assert.IsTrue(mr.Result.Ok);
            Assert.AreEqual(4, mr.Result.InputCount);
            Assert.AreEqual(6, mr.Result.EmitCount);
            Assert.AreEqual(3, mr.Result.OutputCount);
        }
        public void TestExecuteUsing()
        {
            String tempcollname = null;

            using (MapReduceBuilder mrb = mrcol.MapReduceBuilder().Map(mapfunction).Reduce(reducefunction)){
                MapReduce mr = mrb.Execute();
                Assert.IsNotNull(mr.Result);
                Assert.IsTrue(mr.Result.Ok);
                tempcollname = tests.Name + "." + mr.Result.CollectionName;
                bool found = false;
                Assert.IsTrue(tests.GetCollectionNames().Contains(tempcollname));
            }
            Assert.IsFalse(tests.GetCollectionNames().Contains(tempcollname));
        }
예제 #7
0
 public MapReduceBuilder(MapReduce mr)
 {
     this.mr = mr;
 }
예제 #8
0
 public MapReduceBuilder(MapReduce mr)
 {
     this.mr = mr;
 }
예제 #9
0
 public MongoMapReduceException(MongoCommandException mce, MapReduce mr) : base(mce.Message, mce.Error, mce.Command)
 {
     mrr = new MapReduce.MapReduceResult(mce.Error);
 }
예제 #10
0
 public MongoMapReduceException(MongoCommandException mce, MapReduce mr)
     : base(mce.Message,mce.Error, mce.Command)
 {
     mrr = new MapReduce.MapReduceResult(mce.Error);
 }