Mongoose - Push value to array which is nested in object which is nested in array

Solution 1:

You can use positional $ operator in this way to do it in a single operation:

Using $ you tell mongo "update the object found in the find stage". In this case "update the object where prop3.title is title3".

Note that you are using arrayFilters instead of positional operator.

db.collection.update({
  "_id": 1,
  "prop3.title": "title3"
},
{
  "$push": {
    "prop3.$.arr": "val4"
  }
})

Example here

Solution 2:

This is one solution which may or may not make sense in your full context.

You would have much more luck using the mongoose Document.save() method. Once you have a local copy of the document, you can simply push to the array:

const doc = await SomeModel.findOne({
    _id: id, 
    "prop3.title": "title3" 
});

doc.prop3[3].arr.push(item);
await doc.save();