📌  相关文章
📜  猫鼬更新对象 _id - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:06.849000             🧑  作者: Mango

代码示例1
const schema = new Schema({ _id: Number });
const Model = mongoose.model('Test', schema);

const doc = new Model();
await doc.save(); // Throws "document must have an _id before saving"

doc._id = 1;
await doc.save(); // works