MongoDB $set和$unset做什么的

2021-01-21 13:54:49

使用$unset去除属性price

2 db.runoob.update({"_id":"5e0da38b6c355e49d8002378"}, {$unset:{"price":0}}); 


 使用$set添加或者修改属性price

 db.runoob.update({"_id":"5e0da38b6c355e49d8002378"}, {$set:{"price":11.1}});