New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query an Array of Embedded Documents #2483
Comments
I came to ask the same question. Though it's not just arrays, I can't figure out how to query nested objects either (if |
I also encountered the same problem. |
I too have the same problem. Pretty hard to believe that TypeOrm doesn't offer that feature. Switching to Mongoose if this is not solved. |
Hi, I think this another issue could be related #1766 |
@CosmoFruit try it: const u: User = await this.userRepository.findOne({
"accounts.id": targetAccauntId
}) or const u: User = await this.userRepository.findOne({
{accounts: {id: targetAccauntId}}
}) |
See #3756 |
Sorry but both of this options are not working, they are returning only undefined |
|
For questions, please check out the community slack or check TypeORM's documentation page on other support avenues - cheers! |
I tried this code for save data to test but accounts fill is null affter transform: |
You can use aggregation it support nested document query and typeorm support aggregation |
const u: User = await this.userRepository.findOne({ |
Issue type:
[X] question
[ ] bug report
[ ] feature request
[ ] documentation issue
Database system/driver:
[ ]
cordova
[X]
mongodb
[ ]
mssql
[ ]
mysql
/mariadb
[ ]
oracle
[ ]
postgres
[ ]
sqlite
[ ]
sqljs
[ ]
react-native
[ ]
expo
TypeORM version:
[X]
latest
[ ]
@next
[ ]
0.x.x
(or put your version here)I have two entities:
i try find user by account id:
but result is empty
how to right search in array of embedded entities?
The text was updated successfully, but these errors were encountered: