MongoDB updateOne方法更新与过滤器不匹配的文档

sg3maiej  于 2022-12-22  发布在  Go
关注(0)|答案(1)|浏览(132)

updateOne()正在更新与筛选器不匹配的文档...
数据库中采样数据。测试:

[
{name: "Fred", age:30},
{name: "Barney", age:25}
]

我在上面运行了以下代码:

data = {name: "Fred", age: 40}
db.test.updateOne({x:"x"}, {$set:data})

结果:

[
{name: "Fred", age:40},
{name: "Barney", age:25}
]

???

相关问题