css - CastError:模型“User”的路径“_id”处的值“app.css”转换为 ObjectId 失败
问题描述
app.get("/my/:id",isLoggedIn,function(req,res){
User.findById(req.params.id,function(err,user){
if(err){
console.log(err);
res.redirect("/");
}else{
console.log(user);
res.render("profile",{user:user});
}
});
});
这是我的代码,我的 css 文件在此页面上没有加载,而在其他页面上加载
解决方案
正如错误所说:值被传输到只接受可以转换为 ObjectId 的值app.css
的 db 查询 ( )。User.findById(...)
推荐阅读
- python - 当 unix 服务器使用 VShell 时使用 paramiko
- prometheus - 呼叫警报与 Prometheus Alertmanager 集成
- angular -
不是已知元素。请确认它是此模块的一部分 - node.js - Sails:在单个服务器中使用不同的项目
- jira - 共享私有 JIRA 过滤器
- java - chromedriver 尝试获取特定元素的屏幕截图时出错
- javascript - 如何在不注销 Javascript 和 firebase 用户的情况下更改页面
- c# - 如何在 Unity 中锁定我的相机 Z 轴旋转?
- android - 回收站视图或任何视图下方的 BottomSheet peekHeight
- jquery - vue js中如何包含jquery库以及如何调用?