Is it possible to use Push or addToSet for multiple items, for example this code add's one note if it doesn't exist yet, in a subdocument array for user. But what if I have 200 notes?
const note = { id: 1 };
User.update(
{name: 'admin', 'notes.id': {$ne: note.id}},
{$push: {notes: note}},
function(err, numAffected) { ... });
Is it okay to use a foreach loop and run this code 200 times?