📅  最后修改于: 2022-03-11 15:04:06.849000             🧑  作者: Mango
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