// keep N-day worth of data var days=14; // change to false to have the script to really exclude old records // from the database. While true, no change at all will be made to the DB var dryrun=true; var now = new Date().getTime(), time_criteria = now - days * 86400 * 1000, time_criteria_in_seconds = time_criteria / 1000; print((dryrun ? "[dryrun] " : "") + "pruning data older than " + days + " days (" + time_criteria + ")... "); use ace; var collectionNames = db.getCollectionNames(); for (i=0; i