Skip to content

Commit

Permalink
add default read concern set to available
Browse files Browse the repository at this point in the history
  • Loading branch information
GordeaS authored and GordeaS committed Apr 24, 2024
1 parent f67e85d commit bbe3408
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.mongodb.MongoClientOptions;
import com.mongodb.MongoClientURI;
import com.mongodb.MongoException;
import com.mongodb.ReadConcern;
import com.mongodb.ReadPreference;
import com.mongodb.WriteConcern;
import dev.morphia.Datastore;
Expand Down Expand Up @@ -133,18 +134,24 @@ protected MongoClientOptions.Builder buildMongoConnectionOptions(String connecti
}

//set read and write concerns
mco.readPreference(getReadPreference());
mco.writeConcern(getWriteConcern());
mco.readPreference(defaultReadPreference());
mco.writeConcern(defaultWriteConcern());
mco.readConcern(defultReadConcern());
return mco;
}


protected WriteConcern getWriteConcern() {
private ReadConcern defultReadConcern() {
return ReadConcern.AVAILABLE;
}


protected WriteConcern defaultWriteConcern() {
return WriteConcern.MAJORITY;
}


protected ReadPreference getReadPreference() {
protected ReadPreference defaultReadPreference() {
return ReadPreference.primaryPreferred();
}

Expand Down

0 comments on commit bbe3408

Please sign in to comment.