diff options
author | Eliot Horowitz <eliot@10gen.com> | 2010-11-09 18:40:10 -0500 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2010-11-09 18:40:10 -0500 |
commit | d14cb30a7a1041e7e3f57f3837cf270f0bbd86d2 (patch) | |
tree | e2f24529499bb983790289f162278ca62f78e309 /jstests/mr_index2.js | |
parent | 31a3c0bc0f41db8b9146ca5af019d7da91675dab (diff) | |
download | mongo-d14cb30a7a1041e7e3f57f3837cf270f0bbd86d2.tar.gz |
test for SERVER-1904
Diffstat (limited to 'jstests/mr_index2.js')
-rw-r--r-- | jstests/mr_index2.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/jstests/mr_index2.js b/jstests/mr_index2.js new file mode 100644 index 00000000000..769d6cfb0ba --- /dev/null +++ b/jstests/mr_index2.js @@ -0,0 +1,21 @@ + +t = db.mr_index2; +t.drop() + +t.save( { arr : [1, 2] } ) + +map = function() { emit(this._id, 1) } +reduce = function(k,vals) { return Array.sum( vals ); } + +res = t.mapReduce(map,reduce, { query : {} }) +assert.eq( 1 ,res.counts.input , "A" ) + + +res = t.mapReduce(map,reduce, { query : { arr: {$gte:0} } }) +assert.eq( 1 ,res.counts.input , "B" ) + +t.ensureIndex({arr:1}) +res = t.mapReduce(map,reduce, { query : { arr: {$gte:0} } }) +assert.eq( 1 ,res.counts.input , "C" ) + + |