Question

When storing a timestamp in mongodb should I store the 'unix-time' millis since some date or should I store an actual date/time?

What are the benefits of either?

Edit

To be more specific should I store a long that is seconds since Jan 1. 1970, or should I store a Javascript date object.

Was it helpful?

Solution

I recommend using the MongoDB native date format. The advantage of that is that you can then easily use the date operators: http://docs.mongodb.org/manual/reference/operator/aggregation-date/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top