Skip to content

Commit 253ca07

Browse files
author
Ryan
committed
Moved variable calls to method to fix read preference hierarchy - JAVA-467
1 parent c3e8a03 commit 253ca07

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/com/mongodb/DBCollection.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ public final DBObject findOne( Object obj )
329329
* @dochub find
330330
*/
331331
public final DBObject findOne( Object obj, DBObject fields ) {
332-
Iterator<DBObject> iterator = __find(new BasicDBObject("_id", obj), fields, 0, -1, 0, getOptions(), _readPref, _decoderFactory.create() );
332+
Iterator<DBObject> iterator = __find(new BasicDBObject("_id", obj), fields, 0, -1, 0, getOptions(), getReadPreference(), _decoderFactory.create() );
333333
return (iterator != null ? iterator.next() : null);
334334
}
335335

@@ -565,7 +565,7 @@ public void setHintFields( List<DBObject> lst ){
565565
* @dochub find
566566
*/
567567
public final DBCursor find( DBObject ref ){
568-
return new DBCursor( this, ref, null, _readPref );
568+
return new DBCursor( this, ref, null, getReadPreference());
569569
}
570570

571571
/**
@@ -592,7 +592,7 @@ public final DBCursor find( DBObject ref ){
592592
* @dochub find
593593
*/
594594
public final DBCursor find( DBObject ref , DBObject keys ){
595-
return new DBCursor( this, ref, keys, _readPref );
595+
return new DBCursor( this, ref, keys, getReadPreference());
596596
}
597597

598598

@@ -602,7 +602,7 @@ public final DBCursor find( DBObject ref , DBObject keys ){
602602
* @dochub find
603603
*/
604604
public final DBCursor find(){
605-
return new DBCursor( this, null, null, _readPref );
605+
return new DBCursor( this, null, null, getReadPreference());
606606
}
607607

608608
/**
@@ -623,7 +623,7 @@ public final DBObject findOne()
623623
*/
624624
public final DBObject findOne( DBObject o )
625625
throws MongoException {
626-
return findOne( o, null, _readPref );
626+
return findOne( o, null, getReadPreference());
627627
}
628628

629629
/**
@@ -634,7 +634,7 @@ public final DBObject findOne( DBObject o )
634634
* @dochub find
635635
*/
636636
public final DBObject findOne( DBObject o, DBObject fields ) {
637-
return findOne( o, fields, _readPref );
637+
return findOne( o, fields, getReadPreference());
638638
}
639639
/**
640640
* Returns a single object from this collection matching the query.

0 commit comments

Comments
 (0)