Skip to content

Commit 77b253d

Browse files
Merge pull request #1581 from BlindBadCat/patch-1
docs(@nestjs/mongoose): rm anonymous functions in .pre hooks
2 parents 1a46828 + c44e1d4 commit 77b253d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/techniques/mongo.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ Middleware (also called pre and post hooks) are functions which are passed contr
265265
name: Cat.name,
266266
useFactory: () => {
267267
const schema = CatsSchema;
268-
schema.pre('save', () => console.log('Hello from pre save'));
268+
schema.pre('save', function() { console.log('Hello from pre save') });
269269
return schema;
270270
},
271271
},
@@ -286,11 +286,11 @@ Like other [factory providers](https://docs.nestjs.com/fundamentals/custom-provi
286286
imports: [ConfigModule],
287287
useFactory: (configService: ConfigService) => {
288288
const schema = CatsSchema;
289-
schema.pre('save', () =>
289+
schema.pre('save', function() {
290290
console.log(
291291
`${configService.get('APP_NAME')}: Hello from pre save`,
292292
),
293-
);
293+
});
294294
return schema;
295295
},
296296
inject: [ConfigService],

0 commit comments

Comments
 (0)