title: TypeError: User.generateAuthToken is not a function
body: <pre><code>userSchema.methods.generateAuthToken = async function() {
     const user = this    
     const token = jwt.sign({_id:user._id.toString()},'thisisnewcourse')
     return token}
  
  const token = await User.generateAuthToken()
  </code></pre>
  <p>When I call the generateAuthToken(), its showing type error. Line 1 is showing error.</p>