Reputation: 13627
I'm trying to store and retrieve a date in mongojs. Here's how it's saved:
var game = { startedOn: new Date() };
db.games.save(game);
When I fetch it, the date is not a date anymore. It's some kind of wrapper around a date. The _d
field seems to be a date, but it's weird that I should have to access it that way.
db.games.find(function(err, games){
console.log(game[0].startedOn);
});
This logs:
{ _useUTC: true,
_isUTC: true,
_l: null,
_i: null,
_f: null,
_d: Sun Jun 09 2013 21:49:26 GMT-0500 (CDT) }
What's the right way to store/retrieve a date in mongo-js?
Upvotes: 2
Views: 472