What you want is:
mongo sm-repository2.db.qa.test.com:27017/testdb --eval "db.stats()"
Or for longer scripts:
mongo sm-repository2.db.qa.test.com:27017/testdb script.js
출처 : http://stackoverflow.com/questions/4837673/how-to-execute-mongo-commands-through-shell-scripts