Currently, the default MongoDB version that comes with embedded MongoDB dependency in spring boot is 3.5.5, the latest available version is 4.4.5. Request you to either upgrade it to a 4+ version or provide the documentation on how to change the default version.

Comment From: philwebb

You can change the version by setting spring.mongodb.embedded.version. I think we should align with the managed dependency going forward.

Comment From: snicoll

See also #14476 for a similar request. @philwebb I wonder what you had in mind to align the two going forward considering it is now hardcoded in code.

Comment From: wilkinsona

When I updated the issue's title, I had naively assumed there would be some sort of mapping between the version of the Java Driver and the version of MongoDB that we should use by default. We could then have used com.mongodb.internal.build.MongoDriverVersion.VERSION in a test to check that the two were aligned. Unfortunately, there's no such mapping. The latest Java driver version is 4.2.3 while the latest MongoDB version is 4.4.5. The 4.2 driver is compatible with MongoDB 4.4, 4.2, 4.0, 3.6, 3.4, 3.2, 3.0, and 2.6.

Comment From: wilkinsona

I wonder if we should require users to set spring.mongodb.embedded.version in order to use embedded MongoDB. The version really needs to align with whatever version of MongoDB is being used in production and I can't see how we can provide a sensible default value for that.

Testcontainers made some changes a while ago to deprecate all of the default constructors that cause a default tag to be used. This feels quite similar to me.

Comment From: rajadilipkolli

Hi @philwebb @snicoll , When I am playing with setting spring.mongodb.embedded.version I found that we can only set the versions that are declared here so that embedded DB jar can download without any issue.

For example, if I want to use 4.4.1 it will give 403. So letting users choose the version number by default will break or we need to document it carefully.

Comment From: snicoll

Closing in favor or PR #27108