Skip to content

Commit

Permalink
silly mr test
Browse files Browse the repository at this point in the history
  • Loading branch information
erh committed Mar 22, 2010
1 parent 7a118d5 commit f154df0
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions jstests/mr5.js
Expand Up @@ -26,12 +26,31 @@ r = function( k , v ){
}

res = t.mapReduce( m , r , { scope : { xx : 1 } } );
res.find().forEach( printjson )
//res.find().forEach( printjson )

z = res.convertToSingleObject()
assert.eq( 2 , Object.keySet( z ).length , "A" )
assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "B" )
assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "B" )
assert.eq( 2 , Object.keySet( z ).length , "A1" )
assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "A2" )
assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "A3" )


res.drop()

m = function(){
var x = "partner";
var y = "visits";
emit( this[x] , { stats : [ this[y] ] } )
}



res = t.mapReduce( m , r , { scope : { xx : 1 } } );
//res.find().forEach( printjson )

z = res.convertToSingleObject()
assert.eq( 2 , Object.keySet( z ).length , "B1" )
assert.eq( [ 9 , 11 , 30 ] , z["1"].stats , "B2" )
assert.eq( [ 9 , 41 , 41 ] , z["2"].stats , "B3" )


res.drop()
Expand Down

0 comments on commit f154df0

Please sign in to comment.