how to get mongodb current featureCompatibilityVersion into a variable with only version
instead of printing like this
db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } )
{ "featureCompatibilityVersion" : { "version" : "4.0" }, "ok" : 1 }
Assign only version to a variable using mongo shell
fcv_version=$(eval "mongo <connection paramaeter> --eval '<oneliner to get fcv version>')
echo $fcv_version
4.0