Crontask to run a mongoshell command

I was wondering how can I create a cron task that runs a command on a mongoshell connection.

Basically I would like to be able to connect to the mongoshell once a month an run a specific command.
As an example, It would look something like this:

ssh_user@server# mongo
> show dbs
> exit

The version of mongodb that I’m running is MongoDB shell version: 2.0.7


Yes this is possible!

Here is how you would do it for the above example:
mongosh --eval “printjson(db.adminCommand(‘listDatabases’))”

This one switches to to another DB (user db command) and gets the stats:
mongosh --eval “printjson(db=db.getSiblingDB(‘inventory’)); printjson(db.stats())”