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

141
Vistas
App is not connecting to the mongodb Atlas

I start learning JavaScript on the freecodecamp and stuck on a challenge.

The challenge itself is to setup a mongoose. But every time I am submitting my answer it giving me an error of "mongoose should be connected to a database.

I checked the fcc forum on the same topic and all of the solutions not working for me

The challenge provide the starting code and all what is required is to setup mongo atlas and connect your app to it

In the app.js you should add

    require("dotenv").config();
    let mongoose = require("mongoose");

    mongoose.connect(process.env.MONGO_URI, {
      useUnifiedTopology: true,
      useNewUrlParser: true
    });

in the .env file MONGO_URI=mongodb+srv://userName:password@cluster0.rmycu.mongodb.net/myFirstDatabase

Where the userName and password are changed to mine without any prohibited symbols.

You should also add this dependencies to package.json

    "mongodb": "4.1.1",
    "mongoose": "6.0.5"

Any help appreciated

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Can you try to change connection config and use it without additional options:

mongoose.connect(process.env.MONGO_URI);

Since you are using Mongoose version higher than 6.0, these options are not available as config anymore, and are configured automatically.

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