我正在嘗試對文檔執行批量更新插入。我知道這不能在本地完成Meteor:Mongo,必須使用 Node MongoDB librawCollection代替。我有以下const bulkUpserts = [];for (let doc of docs) { bulkUpserts.push({ updateOne: { filter: { fizz: doc.buzz }, update: doc, upsert: true, setOnInsert: { "foo": "bar", "createdBy": Meteor.userId(), "createdDate": new Date() } } });}Collection.rawCollection().bulkWrite(bulkUpserts);^ 的問題是它setOnInsert似乎不起作用。我foo的沒有設置??雌饋韘etOnInsert不能作為updateOne. 有什么選擇呢?令人驚訝的是,我還找不到在 Meteor 中執行此操作的方法。謝謝!
如何執行批量更新插入
森欄
2023-05-11 16:03:19