// query
router.get("/cartList", (req, res, next) => {
User.findOne({ userId: "123456" }, (err, doc) => { });
}
// query
router.get("/cartList", (req, res, next) => {
let userId = req.cookies.userId
console.log(userId)
User.findOne({ userId: userId }, (err, doc) => { });
}
the second method, userId, is also successfully typed, and it is of String type
Why?