Hello, I encountered an error in my Nest app and here is a screenshot of the error:
https://i.stack.imgur.com/zY1io.png
Below is the code snippet for the AppModule:
@Module({
imports: [AppModule,CrudModule,MongooseModule.forRoot("mongodb://localhost:27017/mydb"),AuthModule,UsersModule,MulterModule.register({
dest:'./uploads',
})],
controllers: [AppController],
providers: [AppService,AuthService,UsersService,JwtService],
})
export class AppModule {}
Here is the code snippet for the model:
export interface Credentials extends mongoose.Document{
email:String,
password:String
}
And finally, here is the UsersServices code snippet:
import { Injectable } from '@nestjs/common';
//import {logindto} from 'src/crud/DTO/login.dto'
import {Credentials, StudentModel} from 'src/crud/crud.model'
import {model, Model} from 'mongoose'
import {InjectModel} from '@nestjs/mongoose'
//export type User = any;
@Injectable()
export class UsersService {
constructor(@InjectModel('credentials')private readonly credentials:Model<Credentials> ) {}
//constructor(@InjectModel('student')private readonly credentials:Model<StudentModel> ){}
async findByEmail(username: string): Promise<any> {
return await this.credentials.findOne({
where: {
email: username,
}
});
}
}