Heroku mongodb connection fails

I am struggling with connection to the mongodb problem which I cannot fix:( At localhost everything seems to work but after deploying app to Heroku (using Mongo Atlas) I cannot connect to mongoldb.
here is the log:

2019-12-21T19:01:25.856851+00:00 heroku[web.1]: State changed from starting to up
2019-12-21T19:01:26.092291+00:00 app[web.1]: info: DB Connection Error: failed to connect to server [todolist-shard-00-02-uc00g.mongodb.net:27017] on first connect [MongoNetworkError: connection 4 to todolist-shard-00-02-uc00g.mongodb.net:27017 closed
2019-12-21T19:01:26.092314+00:00 app[web.1]: at TLSSocket.<anonymous> (/app/node_modules/mongoose/node_modules/mongodb/lib/core/connection/connection.js:356:9)
2019-12-21T19:01:26.092316+00:00 app[web.1]: at Object.onceWrapper (events.js:300:26)
2019-12-21T19:01:26.092318+00:00 app[web.1]: at TLSSocket.emit (events.js:210:5)
2019-12-21T19:01:26.092320+00:00 app[web.1]: at net.js:658:12
2019-12-21T19:01:26.092322+00:00 app[web.1]: at TCP.done (_tls_wrap.js:481:7) {
2019-12-21T19:01:26.092324+00:00 app[web.1]: name: 'MongoNetworkError',
2019-12-21T19:01:26.092326+00:00 app[web.1]: [Symbol(mongoErrorContextSymbol)]: {}
2019-12-21T19:01:26.092328+00:00 app[web.1]: }]`

my db file:

const winston = require('winston');
const mongoose = require('mongoose');
const config = require('config')


module.exports = function() {
  const db = config.get('db');
  mongoose.connect(db, {
    useCreateIndex: true,
    useNewUrlParser: true
  })
  .then(() => winston.info(`Connected to ${db}..`))
  .catch(err => {
    winston.info(`DB Connection Error: ${err.message}`)});
  }

defaullt.json:

{
    "jwtPrivateKey": "",
    "db": "mongodb://localhost/ToDoList"
}

custom-environment-variables.json:

{
    "jwtPrivateKey": "ToDoList_jwtPrivateKey",
    "db": "ToDoList_db"
}

heroku config:
ToDoList_db=mongodb+srv://Monika:@todolist-uc00g.mongodb.net/test?retryWrites=true&w=majority

Please help:)

Sorry guys! as soon as I finished this post solution came to me:) I had to allow all IPs instead of mine