title: Getting "Pretty" data from MongoDB JSON object using
body: <p><strong>Update</strong><br>
  After trying out Saravana's solution, I am still getting a weird syntax error. After going through it for an hour I can't figure out why...  (also sorry for the bad copy paste. </p>
  
  <pre><code>db.submissions.aggregate(  
      [  
          {$match: { started: {'$gte': Date('2018-01-02 01:01:01.001'), '$lte': 
  Date('2018-01-02 13:15:59.999' )}}}  
          {$project: { _id: 0,   
              data: [   
                  {$dateToString: { format: "%Y-%m-%dT%H:%M:%S", date: "$started" } },  
                  {$dateToString: { format: "%Y-%m-%dT%H:%M:%S", date: "$finished" } },  
                  '$size'  
                 ]   
              }  
          }  
      ]  
  )  
  </code></pre>
  
  <p>Syntax error on line 4 missing ] at position 8 (but that is before any code, it makes no sense)</p>
  
  <p><strong>Original Post</strong><br>
  I am new to both mongo and JS, so please bear with my "basic" code.
  I am running a query.js, and I get the data I want, I just need to clean it up to look like a csv or something similar... Basically my query returns 2 dates and a file size. (example at bottom)</p>
  
  <pre><code>var cursor=db.submissions.find({started : {'$gte': ISODate('2018-01-02 
  01:01:01.001'), '$lte': ISODate('2018-01-02 13:15:59.999' )}},{started : 1, 
  finished : 1, "inputs.inputFile.size" : 1})
  
  cursor.forEach(printjson);
  </code></pre>
  
  <p>This returns something like this...</p>
  
  <pre><code>"_id" : ObjectId("5a4b7fbe77b5260001843b82"),
  "started" : ISODate("2018-01-02T12:49:03.745Z"),
  "finished" : ISODate("2018-01-02T12:49:05.695Z"),
  "size" : 4560
  
  "_id" : ObjectId("5a4b85be2ea4170001707562"),
  "started" : ISODate("2018-01-02T13:14:39.851Z"),
  "finished" : ISODate("2018-01-02T13:14:44.363Z"),
  "size" : 4547
  </code></pre>
  
  <p>I only want the data (not field names) returned to look like [2018-01-02T12:49:03.745Z, 2018-01-02T12:49:05.695Z, 4560] so I can create a csv. Anyway I am at a complete loss, any help would be appreciated</p>