in the following code, external variables cannot be fetched within $where, for example, req, prompts that req is not defined. Why is the solution?
router.get("/get",(req,res)=>{
comments.find({$where:function(){
return this._id===req.query.id
}},{email:0}).exec((err,docs)=>{
if(err){
res.json({
sts:0,
data:err
})
return
}
res.json({
sts:1,
data:docs
})
})
})