I have an application where the customer creates a company in UI. For every company, I need to create DB in authentication mode with MongoClient in NodeJS.
Databases can be created on the fly. MongoDB will create a database the first time you store data in it (such as when you create a collection in it). See https://docs.mongodb.com/manual/core/databases-and-collections/ for more details.
When using the MongoDB Node.js driver, you can indicate the name of the database and the collection when storing new data. If the database and collection do not exist, MongoDB will create them for you.
Example:
const result = await client.db("sample_airbnb").collection("listingsAndReviews").insertOne(newListing);
The name of the database is "sample_airbnb" and the name of the collection is "listingAndReviews". If those do not exist when this code is executed, MongoDB will create the database and collection. See https://developer.mongodb.com/quickstart/node-crud-tutorial for more examples.