Skip to content
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

Fixes #8796 #8807

Merged
merged 4 commits into from Mar 26, 2022
Merged

Fixes #8796 #8807

merged 4 commits into from Mar 26, 2022

Conversation

chfleury
Copy link
Contributor

@chfleury chfleury commented Mar 26, 2022

Description of change

If you pass false to a field in the select object, it will not select that field.
Before this PR, it would select fields marked as false.


Example:

userRepository.find({
    select: {
        firstName: true,
        lastName: false, // note false
    },
})

would return even properties marked as false

{
    firstName:  'foo',
    lastName:  'bar',
},

now returns

{
    firstName:  'foo',
},

This PR Fixes #8796

I wasn't able to run all the tests, but I ran mine, and it passed.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run format to apply prettier formatting
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

PS: this is my first PR ever.

@chfleury chfleury changed the title Fixes https://github.com/typeorm/typeorm/issues/8796 Fixes #8796 Mar 26, 2022
@pleerock
Copy link
Member

A great first PR! Congratulations 🎉

Looks great, once tests pass I'll merge this PR.

@chfleury
Copy link
Contributor Author

A great first PR! Congratulations tada

Looks great, once tests pass I'll merge this PR.

thank you so much for encouraging new contributors!

@pleerock pleerock merged commit 9ac8e9e into typeorm:master Mar 26, 2022
@pleerock
Copy link
Member

Thank you very much!

M-TGH pushed a commit to TradeCast/typeorm that referenced this pull request Mar 29, 2022
…ypeorm#8807)

* fix: select supports false value instead of only undefined

* test: issue-8796

* refactor: add test description

* refactor: format code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New find select object api should support false values as expected
2 participants