summaryrefslogtreecommitdiff
path: root/jstests/core/mr_comments.js
blob: 406ddb40a45c6ade6338bcd789f6eef5139e37f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

t = db.mr_comments;
t.drop();

t.insert( { foo : 1 } );
t.insert( { foo : 1 } );
t.insert( { foo : 2 } );

res = db.runCommand(
    { mapreduce : "mr_comments",
      map : "// This will fail\n\n    // Emit some stuff\n    emit(this.foo, 1)\n",
      reduce : function(key, values){
          return Array.sum(values);
      },
      out: "mr_comments_out"
    });
assert.eq( 3 , res.counts.emit );

res = db.runCommand(
    { mapreduce : "mr_comments",
      map : "// This will fail\nfunction(){\n    // Emit some stuff\n    emit(this.foo, 1)\n}\n",
      reduce : function(key, values){
          return Array.sum(values);
      },
      out: "mr_comments_out"
    });

assert.eq( 3 , res.counts.emit );