Define cron to delete mongodb table

I want to run the db.clickreferrerurls.remove() command for mongodb from crontab, specifying the cron job on the local machine.

How could I do this?

+4
source share
1 answer

Use the --eval argument for mongo . eg.

 /usr/bin/mongo --eval "db.clickreferrerurls.remove()" 
+6
source

All Articles