📌  相关文章
📜  CastError: Cast to ObjectId failed for value "undefined" at path "_id" for model - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:52.354000             🧑  作者: Mango

代码示例3
import mongoose from "mongoose";

// add this inside your route
if( !mongoose.Types.ObjectId.isValid(id) ) return false;