Nestjs cant connect to mongoDB on raspberry pi

Viewed 452

the mongoDB service starts up nicely. Even in the console are no errors when I start it with mongo. But if I try to serve my nestjs application I get this error: [Nest] 3922 - 03/28/2020, 13:41:08 [MongooseModule] Unable to connect to the database. Retrying (1)... +62ms. My Module looks like this:

import { MongooseModule } from '@nestjs/mongoose';
import { UserModule } from './user/user.module';
import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';

@Module({
  imports: [
    // Mongoose
    MongooseModule.forRoot('mongodb://localhost/api', { useNewUrlParser: true }),

    // Custom Modules
    UserModule,
    MovieModule,
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule { }

I tested it on my Laptop, OS: Ubuntu. The application works fine. So I'm a bit lost here.

0 Answers
Related