Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

save or update mongoose

// 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");
});
Source by mongoosejs.com #
 
PREVIOUS NEXT
Tagged: #save #update #mongoose
ADD COMMENT
Topic
Name
4+3 =