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

Implement $unset aggregation pipeline stage #2676

Merged
merged 7 commits into from
Jun 14, 2023

Conversation

shibasisp
Copy link
Contributor

@shibasisp shibasisp commented May 21, 2023

Description

Closes #1432 .

Implemented $unset aggregation pipeline. Currently this works with:

  • single field
  • multiple fields (array);
  • dot notation support for both.

Readiness checklist

  • I added/updated unit tests.
  • I added/updated integration/compatibility tests.
  • I added/updated comments and checked rendering.
  • I made spot refactorings.
  • I updated user documentation.
  • I ran task all, and it passed.
  • I ensured that PR title is good enough for the changelog.
  • (for maintainers only) I set Reviewers (@FerretDB/core), Labels, Project and project's Sprint fields.
  • I marked all done items in this checklist.

@shibasisp shibasisp requested a review from a team as a code owner May 21, 2023 18:05
@shibasisp shibasisp requested review from AlekSi and rumyantseva May 21, 2023 18:05
@CLAassistant
Copy link

CLAassistant commented May 21, 2023

CLA assistant check
All committers have signed the CLA.

@shibasisp shibasisp changed the title [#1432] Implement pipeline stage [#1432] Implement $unset pipeline pipeline stage May 21, 2023
@shibasisp shibasisp changed the title [#1432] Implement $unset pipeline pipeline stage [#1432] Implement $unset aggregation pipeline pipeline stage May 21, 2023
@codecov
Copy link

codecov bot commented May 21, 2023

Codecov Report

Merging #2676 (fe5cf9d) into main (89d6562) will increase coverage by 0.08%.
The diff coverage is 92.85%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2676      +/-   ##
==========================================
+ Coverage   63.91%   64.00%   +0.08%     
==========================================
  Files         442      443       +1     
  Lines       22602    22658      +56     
==========================================
+ Hits        14447    14502      +55     
- Misses       7207     7208       +1     
  Partials      948      948              
Impacted Files Coverage Δ
...rnal/handlers/common/aggregations/stages/stages.go 29.03% <ø> (ø)
internal/handlers/commonerrors/error.go 80.00% <ø> (ø)
internal/handlers/commonerrors/errorcode_string.go 80.00% <ø> (ø)
...ernal/handlers/common/aggregations/stages/unset.go 92.85% <92.85%> (ø)

... and 1 file with indirect coverage changes

Flag Coverage Δ
integration 57.08% <92.85%> (+0.10%) ⬆️
mongodb 5.00% <0.00%> (-0.02%) ⬇️
pg 57.00% <92.85%> (+0.10%) ⬆️
shard-1 44.32% <0.00%> (+0.47%) ⬆️
shard-2 42.62% <0.00%> (-1.25%) ⬇️
shard-3 43.36% <92.85%> (+1.02%) ⬆️
unit 25.04% <0.00%> (-0.11%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@shibasisp shibasisp marked this pull request as draft May 21, 2023 18:15
@shibasisp shibasisp force-pushed the 1432_implement_unset_pipeline branch from a6c9810 to c47c2c4 Compare May 21, 2023 19:14
@shibasisp shibasisp changed the title [#1432] Implement $unset aggregation pipeline pipeline stage Implement $unset aggregation pipeline pipeline stage May 22, 2023
Copy link
Contributor

@rumyantseva rumyantseva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for contributing!

I see the PR is a draft, but the review was requested, so I leave some comments.

I like the implementation, but I suggest making some additions in tests (see my comments), so we can reveal some problems or errors that need special handling.

Could you also run task lint please? We have some specific rules to format code, it helps us keep the code consistent.

internal/handlers/common/aggregations/stages/unset.go Outdated Show resolved Hide resolved
integration/aggregate_documents_compat_test.go Outdated Show resolved Hide resolved
internal/handlers/common/aggregations/stages/unset.go Outdated Show resolved Hide resolved
@AlekSi
Copy link
Member

AlekSi commented May 29, 2023

@shibasisp Any news? Anything we could help with?

@AlekSi AlekSi added this to the Next milestone May 29, 2023
@AlekSi AlekSi added the code/feature Some user-visible feature is not implemented yet label May 29, 2023
@shibasisp
Copy link
Contributor Author

Apologies for the delay. @AlekSi I will be addressing the comments by this weekend.

@mergify
Copy link
Contributor

mergify bot commented Jun 2, 2023

@shibasisp this pull request has merge conflicts.

@mergify mergify bot added the conflict PRs that have merge conflicts label Jun 2, 2023
@shibasisp shibasisp force-pushed the 1432_implement_unset_pipeline branch from 7adb488 to 857d46b Compare June 2, 2023 09:30
@mergify mergify bot removed the conflict PRs that have merge conflicts label Jun 2, 2023
@shibasisp shibasisp marked this pull request as ready for review June 2, 2023 09:32
@AlekSi AlekSi requested a review from rumyantseva June 2, 2023 09:35
Copy link
Member

@AlekSi AlekSi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not compile

@rumyantseva rumyantseva requested a review from AlekSi June 2, 2023 12:58
@rumyantseva rumyantseva changed the title Implement $unset aggregation pipeline pipeline stage Implement $unset aggregation pipeline pipeline stage Jun 2, 2023
@rumyantseva rumyantseva changed the title Implement $unset aggregation pipeline pipeline stage Implement $unset aggregation pipeline stage Jun 2, 2023
@rumyantseva rumyantseva enabled auto-merge (squash) June 2, 2023 13:03
rumyantseva
rumyantseva previously approved these changes Jun 2, 2023
Copy link
Contributor

@rumyantseva rumyantseva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for contributing!

@AlekSi AlekSi requested a review from noisersup June 2, 2023 15:44
@shibasisp shibasisp dismissed stale reviews from rumyantseva and AlekSi via 9dac010 June 3, 2023 06:38
@rumyantseva rumyantseva requested review from AlekSi and rumyantseva June 5, 2023 08:23
@AlekSi AlekSi modified the milestones: v1.3.0, Next Jun 5, 2023
@AlekSi AlekSi requested a review from chilagrow June 5, 2023 11:14
noisersup
noisersup previously approved these changes Jun 5, 2023
Copy link
Member

@noisersup noisersup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! The logic here looks good to me. I would only suggest to add a comment as it's not clear at the first glance that ProjectionDocument would use exclusion and not inclusion for sure.

Also we might add 3 test cases for $unset field to make a code coverage slightly better:

  • empty array
  • empty string
  • array with empty string

@AlekSi AlekSi enabled auto-merge (squash) June 5, 2023 13:32
Copy link
Contributor

@rumyantseva rumyantseva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the last couple of tests to cover error codes fully!

Copy link
Contributor

@rumyantseva rumyantseva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the last couple of tests to cover error codes fully!

auto-merge was automatically disabled June 10, 2023 14:45

Head branch was pushed to by a user without write access

@shibasisp shibasisp force-pushed the 1432_implement_unset_pipeline branch from 0d66ee9 to 265458f Compare June 10, 2023 15:13
Copy link
Member

@chilagrow chilagrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for your amazing contribution 🤗

@AlekSi AlekSi enabled auto-merge (squash) June 14, 2023 08:41
@AlekSi AlekSi merged commit bdfd6b1 into FerretDB:main Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/feature Some user-visible feature is not implemented yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Implement $unset aggregation pipeline stage
6 participants