MongoDB upsert
upsert = update + insert
If the name matches then it will update the document else add new document
db.collection.updateOne( { name: "codelearningpoint" },{ $set : {age:"2 years" , type:"Blog" } },{upsert : true} )
upsert = update + insert
If the name matches then it will update the document else add new document
db.collection.updateOne( { name: "codelearningpoint" },{ $set : {age:"2 years" , type:"Blog" } },{upsert : true} )
MongoDB Basic and CRUD Operations ...
MongoDB read operation findOne() and find() ...
MongoDB array update operation ...