支持我具有以下对象结构,如何仅更新数组中的最后一个对象?我找不到一个updateOne
语句就能解决的解决方案。
{
history:[
{online: "2019-05-27", offline: null},
{online: "2019-05-27", offline: null} <- only want to update this record
]
}
预期结果:
{
history:[
{online: "2019-05-27", offline: null},
{online: "2019-05-27", offline: "2019-05-27"}
]
}