1
Ich habe einige Kombinationen ausprobiert und die MongoDB 3.2 Dokumente geprüft, aber ich bekomme mein neues Date() immer noch nicht in meiner DB gespeichert. Alles andere wird richtig gespeichert. Vielen Dank im Voraus für irgendwelche Tipps!
-Code aus meiner app.js Datei:
db.collection('users').update({user: req.user.username}, {
$push: {
"recentPlays": {
"quiz": req.session.mostRecentQuiz,
"score": score
}
}
},{
$set: {
"mostRecentQuiz.quizObj": req.session.mostRecentQuiz,
"mostRecentQuiz.time" : new Date() // StackOverflow: this is the part that is not getting stored in the DB.
}
}, function (err, result) {
if (err) throw err;
console.log(result);
});
zum Speichern von Zeitstempel Versuchen anstelle des Objekts: "Date.now()" statt "new Date()" – Nosyara
@Nosyara Dank für Ihre Antwort. Ich habe gerade versucht Date.now() und es funktioniert auch nicht. "new Date()" funktioniert an anderer Stelle in meiner App. –