Model.find() returns pending promise , but logs actual collection?


Im trying to get data from my DBatlas cluster with Model.find(), but I think something is not working with my async function. function returns a pending promise but im able to console.log the actual cluster objects. How can I store my collection with node.js ?

async function dbData() {


        let dbData= await formModel.find({})

        //console.log(dbData) //Console logs succesfully

        return dbData







This is using MongoDB NodeJS driver:

const MongoClient = require('mongodb').MongoClient;
const client = new MongoClient( 'mongodb://localhost:27017', { useUnifiedTopology: true } );

async function getDocs() {

   try {
       await client.connect()
       coll = await client.db('testDB').collection('testColl')
       cursor = await coll.find({})
       return cursor.toArray()
   } catch (e) {
       console.error('Error:', e)
   finally {

(async function() {
    let docsList = await getDocs()
    console.log('Fetched documents:', docsList)