我从遗留代码中获得了"Error: error occured while saving model: VersionError: No matching document found for id "5bb83342342342348a5"。
(相关链接:"VersionError: No matching document found" error on Node.js/Mongoose)
该问题是由于保存了一个非常大的数据集(多个任务,需要2天才能创建)。
现在,我正在尝试重现错误,但我不想花费2~4天来重现这些错误。有没有办法人为地延长锁定-解锁阶段?
发布于 2018-10-17 15:56:15
您要做的是保存自检索以来已修改的文档。下面是一个如何重现它的示例:
// Get the same document twice
const data1 = await model.findOne(...);
const data2 = await model.findOne(...);
data1.someField = x;
data2.someField = y;
await data1.save();
// save is going to throw
await data2.save();https://stackoverflow.com/questions/52836965
复制相似问题