gpt4 book ai didi

javascript - 具有嵌套关系的 TypeORM findOne

转载 作者:行者123 更新时间:2023-12-04 17:21:10 26 4
gpt4 key购买 nike

我在使用 TypeORM 执行嵌套查找查询时遇到一些问题。这是基本代码:

    const { completionId } = req?.params;
const user = req.user;

const retrievedCompletion = await getRepository(
CompletionGoogleSearch
).findOne({
relations: ['run', 'run.user'],
where: {
id: completionId,
// run: { user: { id: user.id } }, // This is the code that breaks the function
},
});

console.log(retrievedCompletion?.run.user.id);
console.log(user.id);
在我看来,一切正常,查询应该运行。知道我做错了什么吗?我知道我可以通过编写查询构建器查询或使用原始 SQL 来解决这个问题——我只是想知道我的代码是否存在缺陷。

最佳答案

typeorm 尚不支持您询问的功能(2021 年 2 月)。
结帐issue于 2018 年开业。

关于javascript - 具有嵌套关系的 TypeORM findOne,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66168437/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com