Hello i have been stuck for days with this one problem..
i do not know how to go about my problem.
i basically want to update mongodb first by finding the projectId,
and then updating bannerData for each projectId found.
my mongodb records:
Below is my mongoose/express-router path.
i feel like i am close but if i put in req.body.bannerData i get undefined...how do i update properly?
router.route('/saveAll/:projectId')
.put((req,res) => {
Banner.updateMany ({ projectId: req.params.projectId }, {
$set: { "bannerData.$[]": req.body}
},
function(err, response) {
if (err) {
res.send(err);
console.log(err);
console.log(req.body);
} else {
console.log(req.params.projectId);
console.log(response);
console.log(req.body);
}
})
});
Below is a bannerData that i wish to push to mongodb


