I have a simple app i implement mongodb from the official site documentation this is my code :
imports: [
MongooseModule.forRoot("mongodb://mongodb:27017/", {
dbName: "mydb",
auth: {
username: "user",
password: "user",
},
}),
RegistrationModule,
AuthModule,
],
controllers: [AuthApiController],
providers: [AuthApiService],
})
export class AuthApiModule {}
im trying this connection string also:
mongodb://user:user@localhost:27017/mydb
i got that error: MongoServerError: Authentication failed.
if set that connection string mongodb://mongodb:27017/mydb its connected well but when i send a request to the server it give me missing auth error