let userRead = (userID, cb) => {
mongoose.connect(`${url}${database}`, optionsConnect);
User.find({uid: userID}, (err, doc) => {
mongoose.disconnect();
cb(doc);
});
};
function callback(res) {
console.log(res); // doc
}
let result = userRead(id, callback);