我在猫鼬身上做了个发现:
var mongoose = require("mongoose");
let User = require("@myRepo/myapp").user;
function getUser(){
mongoose.set("debug", true);
User.find({ _id: currentUserId })
.limit(1)
.exec(function(err, user) {
if (err) {
console.log("err: " + err);
throw err;
}
console.log("user: ", user);
});
}查找“成功运行”,但在执行之前,每次都会在控制台日志中出现“猫鼬”错误。没有错误的功能(错误,用户)是抛出!
这是猫鼬的错误:
myapp | [2017-08-11T15:30:38.505Z] ERROR: sys/289 on 58e82c8426b7: Mongoose: user.find({ _id: 10646 }, { limit: 1, fields: {} }) (type=app)没有关于这个猫鼬错误的详细信息。我如何分析这个错误?
Mongoose.set(“调试”,真);-没有任何影响
发布于 2017-08-16 12:00:06
信息:
myapp | [2017-08-11T15:30:38.505Z] ERROR: sys/289 on 58e82c8426b7: Mongoose: user.find({ _id: 10646 }, { limit: 1, fields: {} }) (type=app)是典型的猫鼬调试模式下的日志消息。文字“错误:”在我的意义上是一个错误。
如果您在代码中注释或删除所有
mongoose.set("debug", true); 并将配置日志级别设置为"info“或更低。
logging: {
level: "info"
},所有日志消息(在本例中,所有带有“ERROR:”的消息)都会消失。
https://stackoverflow.com/questions/45639319
复制相似问题