I am basically trying to update multiple objects in my Mongo database based on their unique objectID (_id). I tried the following steps, but they did not work:
var new_arr = []; for (var i = 0; i < req.body.length; i++) {
I also tried the following with no luck.
var job_applications = req.app.locals.job_applications; var new_arr = []; for (var i = 0; i < req.body.length; i++) {
The only solution I found for this problem is to send multiple updateOne () requests for each object in MongoDB, but this is very inefficient. I believe that there should be a more effective solution to this problem. Any help / guidance is greatly appreciated.
source share