Repository navigation
Closed as not planned
Description
Issue description
I upsert some data, but i found the entity was modified with other id.
Expected Behavior
Entities was modified currectly.
const effectFiles: EffectFile[] = [];
// some create entities logic
console.log(effectFiles)
// effectFiles = [
// {
// id: 'b293ab544529f62dba35a2568f64dcca',
// url: 'https://xxxx/b293ab544529f62dba35a2568f64dcca' ,
// },
// {
// id: '10116ad7b236283e72a8f9e00c4004bc',
// url: 'https://xxxx/10116ad7b236283e72a8f9e00c4004bc' ,
// },
// ]
await FileRepository.upsert(effectFiles, ['id']);
console.log(effectFiles)
// effectFiles = [
// {
// id: 'b293ab544529f62dba35a2568f64dcca',
// url: 'https://xxxx/b293ab544529f62dba35a2568f64dcca' ,
// loaded: false,
// },
// {
// id: '10116ad7b236283e72a8f9e00c4004bc',
// url: 'https://xxxx/10116ad7b236283e72a8f9e00c4004bc' ,
// loaded: false,
// },
// ]Actual Behavior
Entities was modified currectly.
const effectFiles: EffectFile[] = [];
// some create entities logic
console.log(effectFiles)
// effectFiles = [
// {
// id: 'b293ab544529f62dba35a2568f64dcca',
// url: 'https://xxxx/b293ab544529f62dba35a2568f64dcca' ,
// },
// {
// id: '10116ad7b236283e72a8f9e00c4004bc',
// url: 'https://xxxx/10116ad7b236283e72a8f9e00c4004bc' ,
// },
// ]
await FileRepository.upsert(effectFiles, ['id']);
console.log(effectFiles)
// effectFiles = [
// {
// id: '10116ad7b236283e72a8f9e00c4004bc', // **wrong id !!!**
// url: 'https://xxxx/b293ab544529f62dba35a2568f64dcca' ,
// loaded: false,
// },
// {
// id: 'b293ab544529f62dba35a2568f64dcca', // **wrong id !!!**
// url: 'https://xxxx/10116ad7b236283e72a8f9e00c4004bc' ,
// loaded: false,
// },
// ]Steps to reproduce
- create some entites
- upsert them
- some the entites will be incorrectly modified!
My Environment
| Dependency | Version |
|---|---|
| Operating System | windows |
| Node.js version | 16.17.1 |
| Typescript version | 5.6.2 |
| TypeORM version | 0.3.20 |
Additional Context
@Entity('effect_file')
export class EffectFile {
@PrimaryColumn('varchar')
id!: string;
@Column('varchar')
url!: string;
@Column('boolean', { default: false })
loaded!: boolean;
}Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqlite-abstract
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, but I don't know how to start. I would need guidance.
Activity
wuuli commentedon Oct 2, 2024
I found that the reason is the order of
returningResultis different withentityIds.github-actions commentedon Sep 18, 2025
TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).
As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.
🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.