The MongoDB 5.0 Java Driver ships with previously deprecated API now removed (mongodb/mongo-java-driver#1268). To allow users to downgrade if needed, calls to those parts of the driver need to be done reflectively.
Related to: spring-projects/spring-data-mongodb#4663
Comment From: wilkinsona
Thanks, @christophstrobl. Do you anticipate a strong need to downgrade to the 4.x driver? If at all possible, we'd prefer not to support two different major versions at the same time.
Comment From: christophstrobl
There's a few more places with removed API around indexing options, etc. and as far as I know the 5.0 release is one of the more aggressive ones in terms of breaking changes done by the MongoDB team so far. For data we intend to support both 5.0 and 4.11 for the 2024.0 train and remove backwards compatibility with 2024.1.
Comment From: christophstrobl
Given the change in boot is quite limited I guess it would also work to just upgrade and remove the code path for the StreamFactoryFactory. People would still be able to downgrade using TransportSettings which is the preferred one anyways.
Comment From: wilkinsona
That sounds good to me. We can always restore Mongo Driver 4.x compatibility if we get enough feedback in that direction.
Comment From: wilkinsona
To be merged after M3 and once we're back on Data snapshots again.
Comment From: mauhiz
MongoDB driver v5 adds a coroutine-based driver ( https://www.mongodb.com/docs/drivers/kotlin/coroutine/current/ ) Would it make sense to select this one over the reactivestreams based one when the corresponding libraries (kotlinx.coroutine?) are available?
Comment From: christophstrobl
@mauhiz IIRC the com.mongodb.kotlin.client.coroutine.MongoClient is a wrapper around the com.mongodb.reactivestreams.client.MongoClient.
For data-mongodb the Kotlin variants cannot be used directly along with the DatabaseFactory implementations. There's an open PR#4402 in the data project for that, but it would require to access mongodb driver internals reflectively.
Comment From: wilkinsona
Superseded by #40259.