title: Inserting date value from nodejs to mongodb
body: <p>I am trying inserting one date value from expressjs to mongodb. I am using mongodb native driver.</p>
  
  <p>The issue is when I am using creating an object and inserting it using that variable , the date is inserted as string. Here is the sample-</p>
  
  <pre><code>var expenseTest = {date: new Date()};
  
  database.collection('expensemaster').insert(expenseTest, function(err, r){
      console.log("query executed");
  });
  </code></pre>
  
  <p>Here the the value in DB-</p>
  
  <pre><code>{
      "_id" : ObjectId("584f9b6e8c06a5717d10ee59"),
      "date" : "2016-12-13T06:55:24.698Z",
  }
  </code></pre>
  
  <p>But when I am inserting the object directly in the insert query its date is returning as ISODate(date).</p>
  
  <p>Here is the sample-</p>
  
  <pre><code>database.collection('expensemaster').insert({date: new Date()}, function(err, r) {
      console.log("query executed");
  });
  </code></pre>
  
  <p>The value in db- </p>
  
  <pre><code>{
      "_id" : ObjectId("584fba82566fc8787e75a7ed"),
      "date" : ISODate("2016-12-13T09:08:18.441Z")
  }
  </code></pre>
  
  <p>My question is -  what if I have to use insertMany to insert array of object having date as one of the field. </p>
  
  <p>How can I get date as ISODate(date) in the db.</p>