Hi,
We are using Mongo 5.0 and have implemented their stable-api. We now find the Mongo health-check no longer works and reports the following error -> error 323 (APIStrictError): 'Provided apiStrict:true, but the command buildInfo is not in API Version 1.
On closer inspection, the class uses the buildinfo command (https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/mongo/MongoHealthIndicator.java) and this is not supported in Mongo's versioned api -> https://www.mongodb.com/docs/manual/reference/stable-api/#api-v1-commands
Are there plans to use commands supported by the versioned api?
Comment From: wilkinsona
Are you aware of a command in the stable API that can act as a replacement for buildinfo? Upon an initial look, I couldn't see one that would provide a reasonable health check or that provides the version that we currently return in the health details.
Comment From: jyemin
There is no command in the stable API that provides the server version. The closest would be the hello command (formerly isMaster), whose reply includes the maxWireVersion field. This field in incremented with every major release of the MongoDB server, but not patch releases. So it can be used as a rough substitute for the version field in buildInfo, but it is not an exact replacement.
Comment From: philwebb
Assuming that hello is available in both the stable and regular API we'll switch to that in 3.0.x. We'll replace the version detail with maxWireVersion since those represent different things.
If someone wants to use the stable API with 2.x we suggest that they write their own HealthIndicator since it's not much code.
Comment From: jyemin
The hello command is available in both stable and regular API, but it was only added to the server in the 4.2 release. So probably safer to stick with isMaster to support a wider range of server releases. The isMaster command is also part of the stable API, so it's safe to use.
Comment From: mbhave
Keeping the issue open to remind me to update the release notes.
Comment From: jorgelc
Hi. I just came across of this issue.
Using isMaster is still yielding an error when strict is set to true.
@jyemin , as far as I can tell, isMaster is not part of the stable API as far back as from version 5.0 https://www.mongodb.com/docs/v5.0/reference/stable-api-changelog/
Any chance this is picked up again?
Comment From: wilkinsona
@jorgelc please open a new issue with a minimal sample that reproduces the problem and we will take a look.
Comment From: jorgelc
Thanks, @wilkinsona I have raised https://github.com/spring-projects/spring-boot/issues/41101.