这个工作对我的地方:insertMany无序/ continueOnError在MongoDB中的NodeJS司机
db.collection('test').insert(docsArray, {ordered: false});
蒙戈v2.6.10
驱动的NodeJS v2.0.45
但是,同样的代码在服务器上失败:
蒙戈v2.6.11
驱动的NodeJS v2.0.45
我无法理解为什么。
的driver docs说insert
已在赞成insertOne
/insertMany
/bulkWrite
被depricated。所以,我尝试使用这些新功能,但无济于事。我希望它静静地跳过错误并插入剩余的文档。 现在,insertMany
没有无序的插入和bulkWrite
没有insertMany
目前正在执行此操作的官方方式是什么?
您是否尝试过'【W:1,keepGoing:真正}'而不是'{下令:假}'? – marekful
@marekful我刚刚尝试过(使用'insert'和'insertMany')。它失败了。虽然有文档中有KeepGoing的示例(对于插入)。 – Sudhanshu