As I know how to clone the MongoDB collection by typing the command on cmd. As I want to do clone through javascript which will be running through cron job on nodejs environment.
Like on my app.js file I am calling the file like this
var Message = require('./models/copymessage');
what I would like is like this
var CopyCollection = new CronJob('00 36 17 * * *', function() {
//Some command which can copy the collection.
//I am using MongoDB 3.0+ version
}, null, true, 'Asia/Kolkata');
Any help is appreciated