【发布时间】:2018-11-21 20:25:31
【问题描述】:
我正在使用 TypeORM 查询构建器尝试一些东西。但是在运行下面显示的代码后,我不断收到错误
(node:25699) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: Cannot use a pool after calling end on the pool
如果我首先添加user 关系或location 关系很重要,因为首先添加的关系会按预期添加为关系。之后的那个不断抛出错误。
userIds.forEach(async (userId, i) => {
await getConnection()
.createQueryBuilder()
.relation(Pin, "user")
.of(pinIds[i])
.set(userId);
await getConnection()
.createQueryBuilder()
.relation(Pin, "location")
.of(pinIds[i])
.set(locationIds[i]);
});
【问题讨论】:
标签: query-builder typeorm