Question : show mongodb version
Answered by : fair-fish-92a1lwjgkk0n
mongod --version
Source : | Last Update : Mon, 05 Oct 20
Question : mongodb version check
Answered by : shota-nukumizu
$ mongo --version
MongoDB shell version v5.0.6
Build Info: { "version": "5.0.6", "gitVersion": "212a8dbb47f07427dae194a9c75baec1d81d9259", "modules": [], "allocator": "system", "environment": { "distarch": "x86_64", "target_arch": "x86_64" }
}
Source : https://testdriven.io/blog/fastapi-mongo/ | Last Update : Sun, 07 Aug 22
Question : how to check mongodb version
Answered by : you
import subprocess
# Run the mongod --version command
command = ['mongod', '--version']
result = subprocess.run(command, capture_output=True, text=True)
# Extract the version information from the result
output = result.stdout.strip()
version = output.split('\n')[0].split(' ')[2]
# Print the MongoDB version
print(f"MongoDB version: {version}")
Source : | Last Update : Tue, 19 Sep 23