Async to connect to the db

I had a file snowconversation.js,

When I run node app.js,it is calling registerbot(require(./snowconversation.js))

In that we are sending botId as exports,this botid is coming from config file,now I need to replace that with the botid from db

For that I am connecting to db fetching the data from db,but module.exports sending before the connecting is established

I also tried with async but getting same,