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 $group stage _id expression #3138

Merged
merged 21 commits into from
Aug 3, 2023

Conversation

chilagrow
Copy link
Member

@chilagrow chilagrow commented Aug 1, 2023

Description

Closes #2165.

Highlights:

  • expression in nested document is supported
				bson.D{{"$group", bson.D{
					{"_id", bson.D{{"nested", bson.D{{"v", "$v"}}}}},
				}}},
  • expression and operator combination is supported
				bson.D{{"$group", bson.D{
					{"_id", bson.D{
						{"v", "$v"},
						{"sum", bson.D{{"$sum", "$v"}}},
					}},
				}}},

Readiness checklist

  • I added/updated unit tests (and they pass).
  • I added/updated integration/compatibility tests (and they pass).
  • 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.

@chilagrow chilagrow added the code/feature Some user-visible feature is not implemented yet label Aug 1, 2023
@chilagrow chilagrow self-assigned this Aug 1, 2023
@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Merging #3138 (63e103d) into main (cb8a799) will increase coverage by 0.00%.
The diff coverage is 78.94%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3138   +/-   ##
=======================================
  Coverage   75.30%   75.31%           
=======================================
  Files         393      393           
  Lines       21875    21933   +58     
=======================================
+ Hits        16473    16518   +45     
- Misses       4432     4446   +14     
+ Partials      970      969    -1     
Files Changed Coverage Δ
internal/handlers/commonerrors/error.go 80.00% <ø> (ø)
internal/handlers/commonerrors/errorcode_string.go 80.00% <ø> (ø)
...ernal/handlers/common/aggregations/stages/group.go 82.35% <78.94%> (-2.33%) ⬇️

... and 14 files with indirect coverage changes

Flag Coverage Δ
hana ?
integration 71.70% <78.94%> (+0.02%) ⬆️
mongodb 5.37% <0.00%> (-0.02%) ⬇️
pg 65.29% <78.94%> (+0.02%) ⬆️
shard-1 54.56% <15.78%> (-0.04%) ⬇️
shard-2 52.82% <15.78%> (-0.31%) ⬇️
shard-3 58.46% <78.94%> (+0.18%) ⬆️
sqlite 35.57% <0.00%> (-0.57%) ⬇️
unit 24.61% <0.00%> (-0.07%) ⬇️

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

@chilagrow chilagrow changed the title Implement $group _id expression Implement $group stage _id expression Aug 1, 2023
@chilagrow chilagrow marked this pull request as ready for review August 3, 2023 07:56
@chilagrow chilagrow requested a review from a team as a code owner August 3, 2023 07:56
@chilagrow chilagrow requested review from AlekSi, rumyantseva, a team and noisersup August 3, 2023 07:56
@chilagrow chilagrow enabled auto-merge (squash) August 3, 2023 07:56
rumyantseva
rumyantseva previously approved these changes Aug 3, 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! The logic looks clear, and I like that various cases are tested.

rumyantseva
rumyantseva previously approved these changes Aug 3, 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

noisersup
noisersup previously approved these changes Aug 3, 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.

LGTM! Thanks for extended testing

@AlekSi AlekSi dismissed stale reviews from noisersup and rumyantseva via c7cf39b August 3, 2023 13:14
@AlekSi
Copy link
Member

AlekSi commented Aug 3, 2023

CleanShot 2023-08-03 at 18 58 33@2x

I guess force-merging without waiting for Mergify does that 😬 . Please re-approve

@AlekSi AlekSi requested review from rumyantseva, noisersup and a team and removed request for AlekSi August 3, 2023 14:59
@AlekSi AlekSi added this to the Next milestone Aug 3, 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.

:shipit:

@chilagrow chilagrow merged commit 89de046 into FerretDB:main Aug 3, 2023
yonarw pushed a commit to yonarw/FerretDB that referenced this pull request Aug 31, 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.

Support expression of _id in $group aggregation stage
4 participants