withReadPreference

fun withReadPreference(newReadPreference: ReadPreference): MongoCollection<T>

Create a new collection instance with a different read preference.

Return

a new MongoCollection instance with the different readPreference

Parameters

newReadPreference

the new com.mongodb.ReadPreference for the collection