Skip to content

Unknown fields are stripped from WHERE clause #3416

@realyze

Description

@realyze

Issue type:

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

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] 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:
Reproducible with https://github.com/typeorm/typescript-example

  1. Create some categories in the DB

Add this snippet

const categoryRepository = getRepository(Category);
const categories = await categoryRepository.find({doesNotExist: 'any value'} as any);
console.log(categories);

I would expect categories to be empty since we're querying a non-existent field. However the query actually returns everything (i.e., every record in the Category table).

Is there any reason the doesNotExist key is not present in the resulting SQL query please?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions