title: Converting a mongo stored date back into milliseconds since Unix epoch when loaded?
body: <p>I am using Mongoose &amp; Node.js for my webserver. </p>
  
  <p>As a part of one of my document schemas, I have a 'timestamp' field.
  The line for it in the schema is: 
  <code>timestamp: { type: Date, default: Date.now }</code></p>
  
  <p>This works fine, and allows me to retrieve documents based on the timestamp, however, this saves as the ISODate format as described here: <a href="http://docs.mongodb.org/manual/core/document/#date">http://docs.mongodb.org/manual/core/document/#date</a>, like this:</p>
  
  <p><code>"timestamp":"2013-04-04T19:31:38.514Z"</code></p>
  
  <p>I don't mind this, but I send this to the client as is. This means I have to use Date.parse() at the client end before I can comparative operations with it.</p>
  
  <p>Is there any way to either store the date as an integer, or automatically convert it to one when it's retrieved?</p>
  
  <p>Is there any reason I should keep it how it is, and just deal with it at the client end?</p>
  
  <p>Thanks in advance.</p>