withReadPreference

abstract fun withReadPreference(readPreference: ReadPreference): MongoCollection<TDocument>

Create a new MongoCollection instance with a different read preference.

Return

a new MongoCollection instance with the different readPreference

Parameters

readPreference

the new com.mongodb.ReadPreference for the collection