This means that you haven’t set the connection string to the DB correctly. To do so, use this command (with your username, password and dbname):
heroku config:set MONGODB_URL="mongodb+srv://<username>:<password>@<username>.1234x.mongodb.net/<dbname>"
I once had similar issues, I think the problem was that I didn’t use double quotes.