I am trying to connect to local mongoDB in the AppModule by doing the following but it won't connect:
imports: [
    MongooseModule.forRootAsync({
      useFactory: async () => {
        return {
          uri: 'mongodb://localhost:27017/client',
          useNewUrlParser: true,
          useCreateIndex: true,
        };
      },
    }),
  ],
Error from NestJS:
[MongooseModule] Unable to connect to the database. Retrying (1)...
The MongoDB is running fine. I can connect to it through MongoDB Compass with the same uri.
What is done wrong causing the connection not being established?