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

Where clause should error on unknown fields #5657

Closed
glentakahashi opened this issue Mar 10, 2020 · 1 comment
Closed

Where clause should error on unknown fields #5657

glentakahashi opened this issue Mar 10, 2020 · 1 comment
Labels

Comments

@glentakahashi
Copy link
Contributor

glentakahashi commented Mar 10, 2020

Issue type:

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

Database system/driver:

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

TypeORM version:

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

Steps to reproduce or a small repository showing the problem:

Right now if you have an entity A with a relation to B, this will silently drop that part of the where clause and not throw any errors.

repo.find({
  where: {
    bId: 123
  }
}

It works if you do

repo.find({
  where: {
    b: {
      id: 123
    }
  }
}

However, this is an easy mistake to make.

I think TypeORM should throw warnings for unknown fields in the where clause and/or update the typings to not allow unknown fields.

@imnotjames imnotjames added the bug label Oct 6, 2020
@imnotjames
Copy link
Contributor

Duplicate of #3416

@imnotjames imnotjames marked this as a duplicate of #3416 Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants