{
"_id" : "1",
"data" : [
{
"time" : 500,
"offset" : -20,
"sample" : 10
},
{
"time" : 700,
"offset" : -20,
"sample" : 30
}
]
}
例如,如果我传入一个包含值的数组
[
{
"time" : 500,
"offset" : -20,
"sample" : 20
},
{
"time" : 600,
"offset" : -20,
"sample" : 10
}
]
预期产出将是
{
"_id" : "1",
"data" : [
{
"time" : 500,
"offset" : -20,
"sample" : 20
},
{
"time" : 600,
"offset" : -20,
"sample" : 10
},
{
"time" : 700,
"offset" : -20,
"sample" : 30
}
]
}
有没有一种方法可以在一个声明中做到这一点?