TypeORM: How to partialy update given entity with query runner?

Viewed 5685

If I want to partially update my user's name I can easily do this:

await this.repository.save({ id: 1, name: 'john' });

But when I do it with queryrunner, It requires all field to exist and throws missing following properties from type 'User'

await queryRunner.manager.save({ id: 1, name: 'john' }); // Error: Missing property
1 Answers

I guess the save operation will be transformed to insert,maybe you need checking sql executed.And also you can try this:

await queryRunner.manager.update(User, 1, { name: "john" });
Related