withReadPreference

abstract fun withReadPreference(readPreference: ReadPreference): MongoDatabase

Create a new MongoDatabase instance with a different read preference.

Return

a new MongoDatabase instance with the different readPreference

Parameters

readPreference

the new com.mongodb.ReadPreference for the database