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): add FindOptions.exclude #5024

Merged
merged 5 commits into from Dec 17, 2023
Merged

feat(core): add FindOptions.exclude #5024

merged 5 commits into from Dec 17, 2023

Conversation

B4nan
Copy link
Member

@B4nan B4nan commented Dec 16, 2023

Adds the exclude option, which will omit the provided properties and select everything else:

const author = await em.findOne(Author, '...', {
  exclude: ['email', 'books.price'],
  populate: ['books'], // unlike with `fields`, you need to explicitly populate the relation here
});

Copy link

codecov bot commented Dec 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (1e413f1) 99.68% compared to head (2b5161b) 99.68%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5024   +/-   ##
=======================================
  Coverage   99.68%   99.68%           
=======================================
  Files         221      221           
  Lines       16261    16283   +22     
  Branches     3911     3920    +9     
=======================================
+ Hits        16210    16232   +22     
  Misses         51       51           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Adds the `exclude` option, which will omit the provided properties and select everything else:

```ts
const author = await em.findOne(Author, '...', {
  exclude: ['email', 'books.price'],
  populate: ['books'], // unlike with `fields`, you need to explicitly populate the relation here
});
```
Adds the `exclude` option, which will omit the provided properties and select everything else:

```ts
const author = await em.findOne(Author, '...', {
  exclude: ['email', 'books.price'],
  populate: ['books'], // unlike with `fields`, you need to explicitly populate the relation here
});
```
Adds the `exclude` option, which will omit the provided properties and select everything else:

```ts
const author = await em.findOne(Author, '...', {
  exclude: ['email', 'books.price'],
  populate: ['books'], // unlike with `fields`, you need to explicitly populate the relation here
});
```
Adds the `exclude` option, which will omit the provided properties and select everything else:

```ts
const author = await em.findOne(Author, '...', {
  exclude: ['email', 'books.price'],
  populate: ['books'], // unlike with `fields`, you need to explicitly populate the relation here
});
```
@B4nan B4nan merged commit fe239cf into master Dec 17, 2023
11 checks passed
@B4nan B4nan deleted the exclude-fields branch December 17, 2023 00:38
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.

None yet

1 participant