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

feat(core): allow ignoring undefined values in em.find queries #4875

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Oct 24, 2023

The ORM will treat explicitly defined undefined values in your em.find() queries as nulls. If you want to ignore them instead, use ignoreUndefinedInQuery option:

MikroORM.init({
  ignoreUndefinedInQuery: true,
});

// resolves to `em.find(User, {})`
await em.find(User, { email: undefined, { profiles: { foo: undefined } } });

Closes #4873

The ORM will treat explicitly defined `undefined` values in your `em.find()` queries as `null`s. If you want to ignore them instead, use `ignoreUndefinedInQuery` option:

```ts
MikroORM.init({
  ignoreUndefinedInQuery: true,
});

// resolves to `em.find(User, {})`
await em.find(User, { email: undefined, { profiles: { foo: undefined } } });
```

Closes #4873
@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
packages/core/src/utils/Configuration.ts 100.00% <ø> (ø)
packages/core/src/utils/QueryHelper.ts 99.42% <100.00%> (+<0.01%) ⬆️
packages/core/src/utils/Utils.ts 99.40% <100.00%> (+<0.01%) ⬆️
packages/knex/src/query/QueryBuilderHelper.ts 100.00% <100.00%> (ø)

📢 Thoughts on this report? Let us know!.

@B4nan B4nan merged commit e163bfb into master Oct 24, 2023
13 checks passed
@B4nan B4nan deleted the ignore-undefined branch October 24, 2023 16:48
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.

FindQuery empty symbol
1 participant