You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to implement a get multiple api endpoint that can be searched by multiple properties like status, user, and so on. If one of those properties is omitted from the request query it should be ignored by the find query.
Currently if either undefined or null gets passed the column gets queried for null which is not the wanted behaviour for an omitted filter. Adding the option to pass an empty symbol would fix that issue.
Numerous users were asking for undefined to be ignored this way, I am planning to have an option to trigger that behaviour. Do you think we really need some special symbol for that, or will it be enough if undefined behaves like that?
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
…4875)
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
I need to implement a get multiple api endpoint that can be searched by multiple properties like status, user, and so on. If one of those properties is omitted from the request query it should be ignored by the find query.
Currently if either undefined or null gets passed the column gets queried for null which is not the wanted behaviour for an omitted filter. Adding the option to pass an empty symbol would fix that issue.
Example:
currently returns
With an Empty symbol added the code could look like this:
would return
Expanding this same behaviour to query conditions like $gt or $lte would also be amazing.
The text was updated successfully, but these errors were encountered: