我有以下格式的文件:
{
"_id" : ObjectId("58af1ee3f78a9945bd9fc94d"),
"rounds" : {
"matches" : {
"team1" : {
"name" : "Manchester United",
"score1" : 1
},
"team2" : {
"name" : "Tottenham Hotspur",
"score2" : 0
}
}
}}
我想像这样得到这样的感觉:
{
"_id" : ObjectId("SomeID"),
"rounds" : {
"matches" : {
"team1" : {
"name" : "Manchester United",
"score1" : 1
}
}
}
}
和
{
"_id" : ObjectId("SomeID"),
"rounds" : {
"matches" : {
"team2" : {
"name" : "Tottenham Hotspur",
"score2" : 0
}
}
}
}
我正在寻找像展开但放卷的东西只适用于数组。如何将匹配转换为JSON数组?欢迎任何其他想要达到预期结果的想法