I have this code:
async function test() {
var mongo = await MongoClient.connect(connectionString);
var db = await mongo.db(databaseName);
var audit = db.collection(collectionName);
var result = await audit.find({}).toArray();
return arrayData;
}
var myData = test();
But apparently the myData is still the promise object. In C# i know there is function GetAwaiter
to make it wait for the promise to be finished, is there any equivalent of that in NodeJS? or is there any alternative fort this case? thank you.