One of my mongoDB calls is not functioning, and I am unable to figure out why. All others work properly.
The following code is the call
router.get("/", (req, res, next) => {
console.log("BEGIN")
users.find(
{
_id: req.query._id
},
{
perms: 1,
lastName: 1
},
(error, data) => {
if(error) {
return next(error);
} else {
console.log("data: "+data)
res.json(data);
}
console.log("END")
}
)
})
This is the output of the log:
BEGIN
data:
END
GET /userData/?_id=62c5ca2734ed51f3e82bbe56 200 50.509 ms - 2
No data is sent. “perms” is an object and lastName is a string.