U kunt kiezen tussen:
Mongoose Object-weg:
document.dots[0].location.push({ /* your subdoc*/ });
document.save(callback);
Mongo/Mongoose Query (met behulp van $push
en $
operator
):
YourModel.update(
{_id: /* doc id */, 'dots.id': /* subdoc id */ },
{$push: {'dots.$.location': { /* your subdoc */ }},
callback
);