I have this piece of code and in the 2nd function where i check the db if i log stuff inside the function it logs fine but if i assign a var and call the function as it returns a true of false i get a pending promise
const mongoose = require('mongoose')
const config = require('./config.json')
const schema = require('./data')
const mongoactivate = async(config) => {
await mongoose.connect(config.mongo, {
useUnifiedTopology: true,
useNewUrlParser: true
})
}
mongoactivate(config)
const check = async(p, q) => {
let data = await schema.findOne({
username: p,
pass: q
})
let cor = (data === null) ? false : true;
console.log(cor)
}
const ans = check("p", "q")
console.log(ans)