Skip to content

Commit e52faab

Browse files
docs: add save options usage samples
1 parent ca88005 commit e52faab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,11 @@ await factory(User)().makeMany(10, { email: '[email protected]' })
308308
the create and createMany method is similar to the make and makeMany method, but at the end the created entity instance gets persisted in the database.
309309

310310
**overrideParams** - Override some of the attributes of the entity.
311+
**saveOptions** - [Save options](https://github.com/typeorm/typeorm/blob/master/src/repository/SaveOptions.ts) from typeorm
311312

312313
```typescript
313-
create(overrideParams: EntityProperty<Entity> = {}): Promise<Entity>
314+
create(overrideParams: EntityProperty<Entity> = {}, saveOptions?: SaveOptions): Promise<Entity>
315+
createMany(amount: number, overrideParams: EntityProperty<Entity> = {}, saveOptions?: SaveOptions): Promise<Entity>
314316
```
315317

316318
```typescript
@@ -320,6 +322,10 @@ await factory(User)().createMany(10)
320322
// override the email
321323
await factory(User)().create({ email: '[email protected]' })
322324
await factory(User)().createMany(10, { email: '[email protected]' })
325+
326+
// using save options
327+
await factory(User)().create({ email: '[email protected]' }, { listeners: false })
328+
await factory(User)().createMany(10, { email: '[email protected]' }, { listeners: false })
323329
```
324330

325331
## ❯ Seeding Data in Testing

0 commit comments

Comments
 (0)