V
V
Vitaly2019-08-09 22:21:33
SQL
Vitaly, 2019-08-09 22:21:33

How (in TypeORM or not only) to search through nested database fields?

Hardcore (demonstrative) example: you need to find the user User, whose user.address.street.name === '...'
It turns out that here you need to do 2 joins and compare deep fields. How to do it right?
Ideally, the question is about the high-level features built into the TypeORM (Node.js) library.
Connoisseurs of SQL, please recall the native query to the database.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2019-08-10
@vshvydky

perhaps the most relevant to your request in the typeorm documentation will be here https://github.com/typeorm/typeorm/blob/master/doc...
emphasis aside

userRepository.find({ relations: ["profile", "photos", "videos", "videos.video_attributes"] });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question