The problem is probably simple, but my 2 AM brain can't understand what's going on anymore. I'm trying to create a profile page that shows basic public info. The way I'm trying to make it work is pulling out the users username from mongodb when registered the account by his specific \_id. If needed, verification I use is JWT.

```
app.post('/api/user-profile', async (req,res) => {
  const { token } = req.body

  if(!token) {
      return res.json({ status: 'error', error: 'not logged in' })
  }

  try {
      const user = jwt.verify(token, JWT_SECRET)
      const userid = user.id

      const result = User.findOne({ userid })

      console.log(result)
      // return res.json({ status: 'ok', name: result })
  } catch(error) {
      // return res.json({ status: 'error', error: 'something went wrong' })
      console.log(error)
  }
})

```

I'm not sure what function should I use, `findOne()` or `findById()`. I tried to look at the documentation at mongoose, but the explanation is a bit too hard for me to understand.

P.S User = the user registration model. If needed I can paste in the code.