Use the DB. Table name. Update mates $unset use for example our table NOPK has two columns with field names that are Script_type we want to delete Script_type=kshell fields > Db.noPK.find () {"_id": ObjectId ("5a50642b908e6b07a84472a2"), "name": "JavaScript", "Value": "Vue.js"} {"_id": ObjectId (" 5a50655b908e6b07a84472a3 ")," name ":" Xshell "," type ":" Script "} {" _id ": ObjectId (" 5a506b40908e6b07a84472a4 ")," name ": "Xshell", "type": "Script"} {"_id": ObjectId ("5a506b9d908e6b07a84472a5"), "name": "Xshell", "type": "Script", "scrip T_type ":" Bash_shell "} {" _id ": ObjectId (" 5a50703c908e6b07a84472a6 ")," name ":" Shell "," type ":" Script "," Script_type " : "Kshell"}> Delete:> db.noPK.update ({"Name": "Shell"}, {$unset: {"Script_type": "Kshell"}}) Writeresult ({" Nmatched ": 1," nupserted ": 0," nmodified ": 1}) > Db.noPK.find () {" _id ": ObjectId (" 5a50642b908e6b07a84472a2 ")," name ":" JavaScript "," Value ":" Vue.js "} {" _id ": ObjectId (" 5a50655b908e6b07a84472a3 ")," name ":" Xshell "," type ":" Script " } {"_id": ObjectId ("5a506b40908e6b07a84472a4"), "name": "XsHell "," type ":" Script "} {" _id ": ObjectId (" 5a506b9d908e6b07a84472a5 ")," name ":" Xshell "," type ":" Script "," script_ty PE ":" Bash_shell "} {" _id ": ObjectId (" 5a50703c908e6b07a84472a6 ")," name ":" Shell "," type ":" Script "}>
MongoDB Deletes a field (key)