сохранение или обновление мангуза
// This will create another document if it doesn't exist
findByIdAndUpdate(_id, { something: 'updated' }, { upsert: true });
florinrelea
// This will create another document if it doesn't exist
findByIdAndUpdate(_id, { something: 'updated' }, { upsert: true });
// SAVE NEW OR UPDATE EXISTING COLLECTION
AnnoucementTagsModel.findOneAndUpdate({_id: announcementId}, newAnnoucementTags, {upsert: true}, function (err, doc) {
if (error) throw new Error(error);
console.log("succesfully saved");
});