Sie können wählen zwischen:
Mongoose-Objektweg:
document.dots[0].location.push({ /* your subdoc*/ });
document.save(callback);
Mongo/Mongoose-Abfrage (unter Verwendung von $push
und $
Betreiber
):
YourModel.update(
{_id: /* doc id */, 'dots.id': /* subdoc id */ },
{$push: {'dots.$.location': { /* your subdoc */ }},
callback
);