I have been having trouble inserting an actual datetime object in mongodb using the mongojs driver for nodejs. Any help?
var currentdate = new Date();
var date
You do not need to do all this manual date creation.
db.test.update({
conversation: conv
}, {
$push:{ messages: {
message: message,
pseudo: name,
current_date: new Date()
} }
}, {
upsert: true
});
would do the job.
Also keep in mind, that in Mongo 2.6 among many other features you can use $currentDate which might be handy.