How to check mongo version from volumes that I've set in the docker-compose.yml file?

Hello @tanapone_kanongsri

Yes it is, sort of. Note that this will only show what version last successfully started the database not what FCV it is at.

On startup mongod will write out the results of some commands to the diagnostic.data folder, this can be parsed to see what version it was running at that time.

This is an example of a data directory that does not start with mongod 4.4

I’m not sure if there are any other tricks to find the info. When I tried a 3.6 database with mongod 4.2 it did say what version the database was at in the error.

bsondump --version
bsondump version: 100.2.0

bsondump --quiet /data/db/diagnostic.data/metrics.2020-10-21T12-27-20Z-00000 | jq -s '.[] | select(.type == {"$numberInt": "0"})| .doc.buildInfo.version'
"3.2.21"

Good write up I found which helped with this:

2 Likes