Push/Pull values on nested array mongoose
So I solved it by removing the console.log() as a second argument to the model.update() function. Apparently this has to be the object with the operation.
The working code for the Model.update function is as follows,
schemasModel.mongo.update( { _id: req.body.documentId, 'dbSchemas.schemaName': req.body.schemaToSearch }, { $push: { 'dbSchemas.$.schemaFields': req.body.newField } }).then(() => { res.send('new field added successfully');});