db.collection.update({条件},{$unset:{字段名:""}})
例如:
db.user.update({name:"zhangsan"},{$unset:{"hobby":"","height":""}});
设置为null:
db.user.update({name:"zhangsan"},{$set:{"hobby":null,"height":null}});
他们分别在表中显示为
db.collection.update({条件},{$unset:{字段名:""}})
例如:
db.user.update({name:"zhangsan"},{$unset:{"hobby":"","height":""}});
设置为null:
db.user.update({name:"zhangsan"},{$set:{"hobby":null,"height":null}});
他们分别在表中显示为