title: MongoDB Script increment the timestamp & Run
body: <p>I want one script where it will check every collection with match case and give the count of documents but I want timestamp should be change automatically and script run for every date.</p>
  
  <p>Script:</p>
  
  <pre><code>db.getCollectionNames().forEach(function(collection) {
     if (collection.indexOf("collection") &gt; -1){
        count = db[collection].count({"timestamp":{$gte:new ISODate("2017-12-01T23:59:59Z"),$lte:new ISODate("2017-12-02T23:59:59Z")}});
   print("Name:-" + collection + ":");
   print("document:- " + count + ":");}});
  </code></pre>
  
  <p>Here, I want timestamp should change accordingly this script run for full month but daywise.How I can write this in Nodejs? To call the script and change the days accordingly.
  Like; Day1 so and so records,so on...</p>
  
  <pre><code>      Day1   Day2   Day3
  Col1   10     20     15
  Col2   20     55     12
  Col3   12     45     88 
  </code></pre>
  
  <p>Please help.</p>