Save output of a Mongo Command to a Variable bash script
Mongo -command have multiple parameters that are handy in this case.
'--eval' let you run commands and '--quiet' keep all clutter away
out=$(mongo --quiet --eval=&quot;db.currentOp()&quot;) ; echo $out