async function fetchUserCollection(callback)
{
await client.connect();
const userCollection = client.db('database').collection('users');
await callback(userCollection);
client.close();
}
I'm trying to move away from callbacks and towards Promises.
However await resolve(userCollection)
would not work here if this was a promise as resolve()
returns immediately.
Is there a way to use promises here? or is a callback necessary here?