Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

388
Vistas
Mongoose failed to connect and Atlas MongoDB expect to whitelist IP while all IP has allowed

I hope someone could help me because I confused with this problem I thought my code is OK but Atlas seems reject so I couldn't connect to Atlas. The connection so simple. I fill those params from nodemon.json:

const {
    MONGODB_ATLAS_USERNAME,
    MONGODB_ATLAS_PASSWORD,
    MONGODB_ATLAS_DBNAME
} = process.env

var mongoose = require('mongoose');
app.listen(PORT, () => {
console.info(`App is running! at http://localhost:${PORT}`)
})   
mongoose.connect(`mongodb://${MONGODB_ATLAS_USERNAME}:${MONGODB_ATLAS_PASSWORD}@cluster0.lzjty.mongodb.net/${MONGODB_ATLAS_DBNAME}?retryWrites=true&w=majority&ssl=true`,{useNewUrlParser:true,useUnifiedTopology:true});

On Atlas, I whitelisted my IP and allow all IP to connect enter image description here But every npm run, the return always:

    App is running! at http://localhost:8080
[1] (node:2012) UnhandledPromiseRejectionWarning: MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://docs.atlas.mongodb.com/security-whitelist/
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It generally happens when you use public IP. It changes every time you connect to the internet and you need to make changes to the MONGO Atlas. I would suggest you make these changes for development.

Follow this:- MongoDB Atlas -> NetworkAccess -> Edit -> Allow Any

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda