I’m trying to create an error message/log using “winston-mongodb” while sending it to my database. In my MongoDB Compass it created a log folder as expected, but there’s no data in it.
router.get("/", async (req, res) => {
throw new Error("Could not get the genres.");
const genres = await Genre.find().sort("name");
res.send(genres);
});
Also “throw new Error(“Could not get the genres.”)” is making the code down below in my get function “unreachable”. Maybe that’s the reason? If so, what do I need to do to fix it? Because it’s giving me an error that says: TypeError: common.clone is not a function
I’m a having a couple problems with this. The logfile.log was created and logs the errors but the errors aren’t logged on the node terminal like how Mosh has it and the meta data in MongoDB is empty. Did you have the same problem???