I am using Mongoose & Node.js for my webserver.
As a part of one of my document schemas, I have a \'timestamp\' field.
The line for it in the schema is:
As a best practice, I would say: keep your data the type it deserves.
Anyway, if your client needs to treat with numbers, you can simply pass the date as milliseconds to the client, and still work with Date objects in Node.
Just call timestamp.getTime()
and ta-da, you have your unix timestamp ready for the client.