I have found a few answers for listing collections in the shell but all the answers I have found for listing collections in a nodejs script seem to have been deprecated, ans
const collections = Object.keys(mongoose.connection.collections);
this gives you a JSON document of your collections.