updateMany in mongodb where record = NaN to record = 0

updateMany in mongodb where record = NaN to record = 0

所以我一直在阅读如何在命令行上执行此操作,到目前为止我的命令看起来像

db.collection.updateMany( { mean: NaN }

但我不确定我的命令的其余部分应该是什么,以便将我的集合中的任何 NaN 字段设置为 0

用它来实现你的目标

db.collection.updateMany( { mean: NaN },{$set:{mean:0}})