In MongoDB, this is the simplified structure of my account document:
account
{ \"_id\" : ObjectId(\"5a70a60ca7fbc476caea5e59\"), \"templates\" :
You can try with bulkWrite operation in mongodb
Account.bulkWrite( req.body.accountTemplates.map((data) => ({ updateOne: { filter: { _id: req.account._id, 'templates.name' : { $ne: data.name } }, update: { $push: { templates: { $each : data } } }, upsert : true } }) ) })