If you are using a MongoDB server then after using connect in the cluster clock on connect and finding the URL, the URL will be somehing like this
<mongodb+srv://Rohan:<password>@cluster0-3kcv6.mongodb.net/<dbname>?retryWrites=true&w=majority>
In this case, don't forget to replace the password with your database password and db name and then use
const client = new MongoClient(url,{useUnifiedTopology:true});