我有一个名为“ x”的密钥,并希望在它出现的所有文档中将其重命名为“ y”。
键可以出现在词典列表中,也可以出现在词典字典中,也可以位于平面词典中。
在所有情况下它都应该起作用。替换应类似于linux的“ sed”命令,该命令将替换显示的所有字符串。
我是mongodb的新手,请帮助我更换密钥。
{
"_id" : ObjectId("5d142cefc796880001cf39e2"),
"tid" : "FW9500-E33-1",
"last_backup" : "1561603396000",
"gissue" : "",
"failed_count" : 1,
"_class" : "do_backup.model.DoBackup",
"backup_info" : [
{
"job_type" : "INSTANTLY",
"filename" : "",
"filepath" : "",
"time_elapsed" : "1mins22sec",
"filesize" : "",
"remarks" : "Comm. Failure",
"status" : "Failure",
"timestamp" : NumberLong("1561603396000"),
"signature" : "NA"
}
]
},
{
"_id" : ObjectId("5d142cefc796880001cf3321"),
"tid" : "FW9500-E33-2",
"last_backup" : "1561603396001",
"gissue" : "1",
"failed_count" : 2,
"_class" : "do_backup.model.DoBackup1",
"backup_info" : [
{
"job_type" : "INSTANTLY1",
"filename" : "",
"filepath" : "",
"time_elapsed" : "1mins22sec",
"filesize" : "",
"remarks" : "Comm. Failure",
"status" : "Failure",
"timestamp" : NumberLong("1561603396001"),
"signature" : "NA"
}
]
}
在一个小场景中,我想将键“状态”更改为“状态”。