嗨,在我的 monogo 收藏中包含以下文件
{
"_id" : ObjectId("52398ba524c8b6f8a7c1cd96"),
"hostid":"127.0.0.1",
"application":[
{
"pid" : "50741",
"local_address" : "127.0.0.2:30501",
"user" : "hcsadm",
"pr" : "20",
"ni" : "0"
},
{
"pid" : "50741",
"local_address" : "127.0.0.2:30509",
"user" : "hcsadm",
"pr" : "20",
"ni" : "0"
},
{
"pid" : "50741",
"local_address" : "127.0.0.2:30505",
"user" : "hcsadm",
"pr" : "20",
"ni" : "0"
}
]
}
现在我想改变上面的结构如下
{
"_id" : ObjectId("52398ba524c8b6f8a7c1cd96"),
"hostid":"127.0.0.1",
"application":[
{
"pid" : "50741",
"local_address" : [{"127.0.0.2:30501","127.0.0.2:30509","127.0.0.2:30505"}],
"user" : "hcsadm",
"pr" : "20",
"ni" : "0"
} ]
}
mongodb中有什么方法可以处理这个问题,我尝试过更新查询,但如果有人知道请帮助我,我已经解决了这个问题。