📌  相关文章
📜  模型“用户”的路径“_id”处的值“t”转换为 ObjectId 失败 - Javascript 代码示例

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

代码示例3
Re-arranging by putting the route the has an id or _id (doesn't really matter) parameter fixed the 
issue for me. For example; 
BEFORE;
    app.use("/api/:id", postDetail); 
    app.use("/api/posts", posts); 
    app.use('/api/orders/', orders); 
    
AFTER;
       app.use("/api/posts", posts); 
    app.use("/api/orders/", orders); 
    app.use("/api/:id", postDetail);