question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InnerJoin and InnerJoinAndSelect not working on nested object

See original GitHub issue

Issue type:

[ ] question [ X] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [ ] mongodb [ ] mssql [ ] mysql / mariadb [ ] oracle [ ] postgres [ ] sqlite [ ] sqljs [ ] react-native

TypeORM version:

[X ] latest [ ] @next [ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

.createQueryBuilder('answerLog')
.innerJoin('answerLog.answer', 'answer')
.innerJoinAndSelect('answer.todo', 'todo')

I’m using this query to get the todo and select thad, but this query results in an answer undefined cause as you can see I’m not using innerJoinAndSelect on the 'answer' in my query. On the previous version of typeorm it was possible to do is, I don’t know if this is a change that was planned or something that broke?

I can easily solve this by doing:

.createQueryBuilder('answerLog')
.innerJoinAndSelect('answerLog.answer', 'answer')
.innerJoinAndSelect('answer.todo', 'todo')

But this will put unnecessary data in my result.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pleerockcommented, May 22, 2018

yeap, so you expect anser to be inside todo, right? If yes, then you must select it.

0reactions
pleerockcommented, May 23, 2018

Okay I already gave you answer. If you want something to be you need to select it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeORM Querybuilder get nested INNER JOIN
I think defining the join condition explicitly would solve the problem. Please check the following query -
Read more >
query, joins and nested relations in TypeORM - YouTube
In this video, we are going to look at how we can work with TypeORM and use joins to load other relations.The idea...
Read more >
Relations FAQ - typeorm - GitBook
Categories can nest categories, nested categories can nest other categories, etc. ... in your object, the id of the related object without loading...
Read more >
8.2.1.8 Nested Join Optimization - MySQL :: Developer Zone
In MySQL, CROSS JOIN is syntactically equivalent to INNER JOIN ; they can replace each other. In standard SQL, they are not equivalent....
Read more >
TypeORM - Query Builder - Tutorialspoint
TypeORM - Query Builder, Query builder is used build complex SQL queries in an easy way. It is initialized from Connection method and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found