- 更新字段(table 代表表名 , 添加字段 content,字符串类型)
db.table.update({}, {$set: {content:"xxx"}}, false,true)
- 删除字段(其实就是用了update命令,把所有的字段值清空)
db.table.update({},{$unset:{content:""}},false, true)
------------------------------------------------------------------------------------------------------------------------------------------
mongodb研究
db.getCollection(‘SS_UniversityInfo‘).update({"SubjectScope":{"$elemMatch":{"XuanKaoSubjectScrope":{"$exists":true}}}},
{"$rename":{"$SubjectScope.$.XuanKaoSubjectScrope":"SubjectScope.$.Scrope"}},false,true)
------------------------------------------------------------------------------------------------------------------------------------------