将update_time字段的值设置为create_time的值:
db.collection_name.find().forEach(
function(item){
db.collection_name.update(
{_id: item._id, create_time: {$exists: true}},
{$set: {update_time: item.create_time}}
)
}
)
类似于js的写法,一个一个替换 相当于MySQL的:
update collection_name set update_time=create_time
标签:段值,name,批量,mongoDB,create,update,collection,time
From: https://www.cnblogs.com/FengZeng666/p/17405688.html