I am trying to push an element to an array in mongoose. I am doing it with update and $push. But it is not updating it in the database. This is my code. routes.js:
As far as I know, you have to do as below.
Model.findAndUpdate({_id: 'your_id'}, {$push: {'your_array_field': {"name": "foo","idAccount": 123456}}}, {new: true}, (err, result) => { // Rest of the action goes here })