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 datetime = currentdate.getDate() + "/"
+ (currentdate.getMonth()+1) + "/"
+ currentdate.getFullYear() + " @ "
+ currentdate.getHours() + ":"
+ currentdate.getMinutes() + ":"
+ currentdate.getSeconds();
db.test.update({
conversation: conv
},{
$push:{ messages: {
message: message,
pseudo: name,
current_date: datetime
}}
},{upsert: true});
new Date()
? – Unbreathed