I don't know how to return true or false from a promise

Hello everybody, I’m doing a login authentication with mongoose and I’m trying to implement a function to check if that username is taken already.

This is my function.

const checkFields = username => {
userSchema.findOne({ "username": username })
    .then(user => {
        return user !== null ? true : false
    })
}

I need to return a true or false from that function to this one

else if (checkFields(req.body.username)) {
    res.render("signup", {
      errorMessage: "The username already exists!"
    })

I tried differents ways but I coudn’t success in any of them. CheckFields is returning undefined because i’m not returning anything. I tried to make a variable and assign to true or false inside of then but I lost the value when I do a return.
I also tried this

const checkFields = username => {
return userSchema.findOne({ "username": username })
    .then(user => {
        return user !== null ? true : false
    })
}

This is the output : Promise { <pending> } so my condition is true all the time.
Could you give me a hand?
Thanks in advanced

Once you land in a Promise chain, everything you depend has to also go into that chain, meaning your callbacks don’t return a value, they return other promises that will have a value passed to their callbacks.
So you have to invert that logic and move your if check to a next then.

userSchema.findOne({ "username": username })
    .then(user => {
        return user !== null
    })
    .then(thatBooleanAbove => {
        somethingelse...
    })

If you want to skip from the chain of promises, look for the new async/await pattern.