mongoDB エラー「uncaught exception: Error: Fourth argument must be empty when specifying upsert and multi with an object.」が発生した場合の対処法
mongoDBで、エラー「uncaught exception: Error: Fourth argument must be empty when specifying upsert and multi with an object.」が発生した場合の対処法を記述してます。
環境
- OS Ubuntu 20.04
- MongoDB 5.0.5
エラー全文
以下を実行時に発生。
db.foo.update( { name:'hoge' }, { $set:{ gender:"x",age: 35 } }, { upsert:false }, { multi:true } )
エラー全文
uncaught exception: Error: Fourth argument must be empty when specifying upsert and multi with an object. :
DBCollection.prototype._parseUpdate@src/mongo/shell/collection.js:472:19
DBCollection.prototype.update@src/mongo/shell/collection.js:510:18
対処法
「upsert」と「multi」を両方指定する際は、以下のようにする必要がある
{ upsert:true, multi:true }
-
前の記事
python PySimpleGUIのTextに枠線をつける 2021.12.09
-
次の記事
javascript lodashでメソッドチェーン中に実行結果を確認する 2021.12.10
コメントを書く