Можете да избирате между:
Mongoose Object-way:
document.dots[0].location.push({ /* your subdoc*/ });
document.save(callback);
Mongo/Mongoose Query (използвайки $push
и $
оператор
):
YourModel.update(
{_id: /* doc id */, 'dots.id': /* subdoc id */ },
{$push: {'dots.$.location': { /* your subdoc */ }},
callback
);