I'm trying to find the user with the incoming request.
router.get("/user", auth, (req, res) => {
const db = mongoUtil.getDb();
db.db("mern-auth-2").collection("users").findOne({_id: ObjectId(`${req.user.id}`)})
.select('-password')
// console.log(req.user.id)
.then(user => res.json(user));
});
The req.user.id is console logging abcdefg for example and in my database it's ObjectId('abcdefg')
How do I compare these 2? Above is currently what I have coded, which doesn't work.