in the export.js file, everything works fine, I can consoleLog the correct collection queried from mongodb, but in the import.js file, the collection is consoleLogged immediately and is undefined, I don't know what's wrong
//export.js
module.exports = client.connect(async () => {
const db = client.db("database");
const collection = await db.collection("collection").find().toArray();
client.close();
console.log(collection);
return collection;
});
//require.js
const collection = require("./export");
console.log(collection);