Skip to content

Commit b5900eb

Browse files
committed
Add ReadPreference to testMapReduceInline
1 parent 2d2a0d6 commit b5900eb

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/com/mongodb/DB.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ boolean obeyReadPreference(DBObject command){
7474
if(comString.equals("mapreduce")) {
7575
DBObject out = (DBObject)command.get("out");
7676
if(out != null){
77-
Object inline = (DBObject)out.get("inline");
77+
Integer inline = ((Integer)out.get("inline"));
7878
return ( inline != null && inline.equals(1));
7979
}
8080
else

src/test/com/mongodb/JavaClientTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ public void testMapReduceInline(){
472472

473473
MapReduceOutput out =
474474
c.mapReduce( "function(){ for ( var i=0; i<this.x.length; i++ ){ emit( this.x[i] , 1 ); } }" ,
475-
"function(key,values){ var sum=0; for( var i=0; i<values.length; i++ ) sum += values[i]; return sum;}" , null, MapReduceCommand.OutputType.INLINE, null);
475+
"function(key,values){ var sum=0; for( var i=0; i<values.length; i++ ) sum += values[i]; return sum;}" ,
476+
null, MapReduceCommand.OutputType.INLINE, null, ReadPreference.primaryPreferred());
476477

477478
Map<String,Integer> m = new HashMap<String,Integer>();
478479
for ( DBObject r : out.results() ){

0 commit comments

Comments
 (0)