mirror of
https://github.com/typeorm/typeorm.git
synced 2025-12-08 21:26:23 +00:00
docs: add documentation for .orIgnore method (#10607)
This commit is contained in:
parent
99d8249e45
commit
032f5350e1
@ -57,6 +57,24 @@ await dataSource
|
||||
.execute()
|
||||
```
|
||||
|
||||
### IGNORE error (MySQL) or DO NOTHING (Postgres) during insert
|
||||
|
||||
If the values you are trying to insert conflict due to existing data or containing invalid data, the `orIgnore` function can be used to suppress errors and insert only rows that contain valid data.
|
||||
|
||||
```typescript
|
||||
await dataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(User)
|
||||
.values({
|
||||
firstName: "Timber",
|
||||
lastName: "Saw",
|
||||
externalId: "abc123",
|
||||
})
|
||||
.orIgnore()
|
||||
.execute()
|
||||
```
|
||||
|
||||
### Skip data update if values have not changed (Postgres)
|
||||
|
||||
```typescript
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user