【发布时间】:2020-06-03 03:46:08
【问题描述】:
在使用其他 mongoose 方法(例如 findOneAndUpdate())时,哪种保存文档的方法更好,这样它就不会导致任何错误?
const doc = new Doc();
// Some lines of the code
doc.save(...)
.then(...)
.catch(...);
OR,
const doc = {};
//Some lines of code
Doc(doc).save()
.then(...)
.catch(...)
【问题讨论】: