Skip to content

Commit ab54332

Browse files
committed
JAVA-686: MongoOptions now sets correct WriteConcern when j=true
1 parent 96747b2 commit ab54332

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/main/com/mongodb/MongoOptions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ public MongoOptions copy() {
106106
public WriteConcern getWriteConcern() {
107107
if (writeConcern != null) {
108108
return writeConcern;
109-
} else if ( w != 0 || wtimeout != 0 || fsync ) {
110-
return new WriteConcern( w , wtimeout , fsync );
109+
} else if ( w != 0 || wtimeout != 0 || fsync | j) {
110+
return new WriteConcern( w , wtimeout , fsync, j );
111111
} else if (safe) {
112112
return WriteConcern.SAFE;
113113
} else {

src/test/com/mongodb/MongoOptionsTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ public void testGetWriteConcern() {
141141
options.reset();
142142
options.fsync = true;
143143
assertEquals(new WriteConcern(0, 0, true), options.getWriteConcern());
144+
145+
options.reset();
146+
options.j = true;
147+
assertEquals(new WriteConcern(0, 0, false, true), options.getWriteConcern());
144148
}
145149
}
146150

0 commit comments

Comments
 (0)