5
Ich versuche, einige Inhalte in Mongoose.js 3.1.2 zu aktualisieren, und ich kann diese beiden Funktionen nicht funktionieren. Irgendwelche Ideen warum? Dank ...Problem beim Speichern in Mongoose 3
function(req, res) {
Content.findById(req.body.content_id, function(err, content) {
// add snippet to content.snippets
content.snippets[req.body.snippet_name] = req.body.snippet_value;
content.save(function(err) {
res.json(err || content.snippets);
});
}
}
function(req, res) {
Content.findById(req.body.content_id, function(err, content) {
// delete snippets
delete content.snippets[req.body.snippet_name];
//content.snippets[req.body.snippet_name] = undefined; <-- doesn't work either
content.save(function(err) {
res.json(err || "SUCCESS");
});
});
}
Mein Schema sieht wie folgt aus:
contentSchema = new Schema(
title: String,
slug: String,
body: String,
snippets: Object
);
Oh wow, Sie haben mich total umgehauen, danke dafür: D – red
Ja! Wie habe ich es vermisst? Danke Bill – Pardoner
Du bist mein Held. – ehaydenr