我想将数据从“demographic.education”列移到“demographic.school”。我怎么能这样做?
例如:
db.users.update({"demographic.education":{$exists: true, $ne: ""}}, {$set: {"demographic.school":demographic.education}})
答案 0 :(得分:2)
您可以使用$rename
修饰符:
db.users.update({"demographic.education": {$exists: true, $ne: ""}}, {$rename: {"demographic.education": "demographic.school"}})