Hello Harsha,
You can use listCollections method to get collections, before that you need to update the below line because I have done it directly with a model in my script,
const firstUseDB = firstConn.useDb(firstDB.db);
Now check is connection open then get the list of collections,
firstConn.on('open', () => {
firstUseDB.db.listCollections().toArray().then((names) => {
console.log(names)
})
.catch((err)=>{
return err;
});
});