我有一个供应表,其中包含名称和数量列。我希望以下代码能够更新数量,但事实并非如此。有人可以更正我的代码吗?
const repository = connection.getRepository('supply');
await repository.update({ quantity: 20 }, { name: 'supply1' });
最佳答案
颠倒顺序:
await repository.update({ quantity: 20 }, { name: 'supply1' }); // tries to update where quantity is 20...
await repository.update( { name: 'supply1' }, { quantity: 20 }); // updates quantity
关于postgresql - Typeorm 不想更新数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56837643/