@NotNull @Override public MongoDatabase withReadConcern(@NotNull ReadConcern readConcern) { return new MongoTestDatabase(db.withReadConcern(readConcern), beforeQueryException, beforeUpdateException, afterUpdateException); }
/** * Retrieves the database with the specified {@code name} on the {@code client}. * The database will be created if it does not already exist. * * @param client the MongoDB client, connected on the server * @param name the name of the database * * @return the database */ @Nonnull private MongoDatabase createDatabase(MongoClient client, String name) { final CodecRegistry registry = fromRegistries( client.getMongoClientOptions().getCodecRegistry(), fromProviders(PojoCodecProvider.builder().automatic(true).build())); return client.getDatabase(name) .withCodecRegistry(registry) .withWriteConcern(WriteConcern.MAJORITY) .withReadConcern(ReadConcern.MAJORITY); } }
&& status.isMajorityReadConcernEnabled() && !MongoConnection.hasReadConcern(uri)) { db = db.withReadConcern(MongoConnection.getDefaultReadConcern(client, db));
&& status.isMajorityReadConcernEnabled() && !MongoConnection.hasReadConcern(uri)) { db = db.withReadConcern(MongoConnection.getDefaultReadConcern(client, db));