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

603
Vistas
Nest can't resolve dependencies of the MongooseCoreModule (MongooseConnectionName, ?)

Nest can't resolve dependencies of the MongooseCoreModule (MongooseConnectionName, ?). Please make sure that the argument ModuleRef at index [1] is available in the MongooseCoreModule context.

I am new to nest and am facing this issue, the app.controller.ts is

import { Module } from '@nestjs/common';
import { ItemsController } from './items.controller';
import { ItemsService } from './items.service';
import { MongooseModule } from '@nestjs/mongoose';
import { ItemSchema } from './schema/item.schema';

@Module({
  imports: [MongooseModule.forFeature([{name:'Item',schema:ItemSchema}])],
  controllers: [ItemsController],
  providers: [ItemsService],
})
export class ItemsModule {}

Any help would be appreciated

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

0

In you case, you can try to add this to your ItemSchema :

// schema/item.schema

@Schema({ collection: 'items' })

And make sure the import with a plural name :

// items.module.ts

// [...]
@Module({
  imports: [MongooseModule.forFeature([{name:'items',schema:ItemSchema}])],
  controllers: [ItemsController],
  providers: [ItemsService],
})
export class ItemsModule {}

According to this question.

Or if you prefer to keep the name schema name item, you can force it by following this answer

Mongoose is trying to be smart by making your collection name plural. You can however force it to be whatever you want:

var dataSchema = new Schema({..}, { collection: 'data' })

about 4 years ago · Juan Pablo Isaza Denunciar

0

This error occurs when you dont start your code in the proper directory in your program folder. So cd navigate to the directory of your project and and run all the codes again.

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