Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

2.7K
Views
Unable to connect to the database. Retrying

I'm trying to connect to the database, seems like the set-up is correct, but for some reason, it says that it is not available.

app.module.ts

import { Module } from "@nestjs/common"
import { MongooseModule } from "@nestjs/mongoose";
import { ConfigModule } from "../config";
import { CreatorModule } from "./creator.module";

@Module({
    imports: [
        MongooseModule.forRoot('mongodb://localhost:27017/snaptoon', {
            useCreateIndex: true,
            useUnifiedTopology: true,
            useNewUrlParser: true,
        }),
        CreatorModule,
    ],
    controllers: [],
    providers: []
})

export class AppModule {}

The error is: ERROR [MongooseModule] Unable to connect to the database. Retrying (9)...

I'm using '@nestjs/mongoose': '9.0.2'

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

I solved by updating manually mongoose version to 6.2.2

 WARN @nestjs/mongoose@9.0.2 requires a peer of mongoose@^6.0.2 but none is installed. You must install peer dependencies yourself.

I realize due to this error on npm install

just use:

 npm install mongoose@6.2.2 --save
over 4 years ago · Santiago Trujillo Report

0

For those people who cannot solve this problem by the answer above, according to the new specs of nestjs/mongoose.

It might be solved by deleting the line: useNewUrlParser: true.

For me, it works in both ways.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!