'While logging out how can I change the 'status' to false?

I'm trying to create a simple logout controller that will clear the cookie and there's a field called status in my mongoose collection , that needs to be turned to 'false' while logging out. how can I do this?

exports.logout=async(req,res,next)=>{
    try{
        res.clearCookie('userToken');
        res.status(201).json({
            type:'Success',
            message:'Logout Successful'
        })

    }catch(error){
        next(error);
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source