mongodb studio 3T tool delete field

db.getCollection("表名").update({"删选条件":{"$exists":true}},{"$unset":{"删除字段名":""}},{multi:true})
# 删除多行 {multi:true} 选择删除单条可以不写
# 通用模板

db.getCollection("表名").update({删选条件},{"$unset":{"删除字段名":""}},{multi:true})

# 举个例子
db.getCollection("user").update({"food":{"$exists":true}},{"$unset":{"food":""}},{multi:true})

Note: After checking most of the information, it is shown that {"$unset":{"delete field name",""}  deletes the field name with commas and connects empty strings . If you try the tool yourself, you will get an error. Personal test, since this article is limited to note taking, so there is no test, whether the comma connection is an application scenario for coding, the tools I use are still different. Please contact me if you have any questions, I will correct them in time.

Guess you like

Origin blog.csdn.net/weixin_43124425/article/details/114385343