Sye*_*zan 8 mongodb mongo-shell
db.movieDetails.updateMany({
"tomato.consensus": null,
"imdb.votes":{$lt:10000},
"year":{$gte:2010,$lte:2013}},
{
$unset:{"tomato.consensus":""
}
})
Run Code Online (Sandbox Code Playgroud)
当我在mongoshell中输入上面的命令时,我收到一条错误,指出这updateMany不是一个有效的函数.
TypeError:对象video.movieDetails的属性'updateMany'不是(shell)的函数:1:17
我检查了文档,updateMany并列出了一个有效的功能.我想知道为什么我收到错误.
该updateMany命令尚未弃用.您可以在此处找到该命令的文档:db.collection.updateMany.
您无法使用该命令,因为它是在3.2MongoDB版本中引入的.您需要安装该3.2版本才能使用该updateMany命令.
这对我有用
db.collection.update({},{$set:{,is_expired:false}},{multi:true})
Run Code Online (Sandbox Code Playgroud)