0
猫鼬更新阵列我有如下猫鼬模型:内部阵列
{
_id: ObjectId("557138249d46084df20620dd"),
name: "Example"
employee: [
{
username: "[email protected]",
address: [
{
street: "123 Hill Ave"
country: US
}
]
}
]
}
可以有很多employee
和每个员工都有一个array
的地址。我想将阵列中的员工的所有地址更新为空数组。所以,结果会像 -
{
_id: ObjectId("557138249d46084df20620dd"),
name: "Example"
employee: [
{
username: "[email protected]",
address: []
}
]
}
如何查询更新所有文件的地址为空数组?谢谢。
您还想更改您的预期输出中的键名,您将'employee'替换为'companies'? – Yogesh