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

Support $rename field update operator #670

Closed
wants to merge 13 commits into from

Conversation

fenogentov
Copy link
Contributor

@fenogentov fenogentov commented May 31, 2022

Closes #626.

@codecov
Copy link

codecov bot commented May 31, 2022

Codecov Report

Merging #670 (1178984) into main (69d220e) will increase coverage by 0.12%.
The diff coverage is 91.17%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #670      +/-   ##
==========================================
+ Coverage   62.91%   63.03%   +0.12%     
==========================================
  Files         191      191              
  Lines        7563     7597      +34     
==========================================
+ Hits         4758     4789      +31     
- Misses       2245     2247       +2     
- Partials      560      561       +1     
Impacted Files Coverage Δ
internal/handlers/common/update.go 88.59% <91.17%> (+1.09%) ⬆️
Flag Coverage Δ
FerretDB 58.68% <91.17%> (+0.14%) ⬆️
MongoDB 6.34% <0.00%> (-0.03%) ⬇️
integration 58.71% <91.17%> (+0.14%) ⬆️
unit 23.15% <0.00%> (-0.11%) ⬇️

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

@fenogentov fenogentov marked this pull request as ready for review June 1, 2022 08:23
@fenogentov fenogentov changed the title Support $rename field update operator Support $rename field update operator. Jun 1, 2022
@fenogentov fenogentov changed the title Support $rename field update operator. Support $rename field update operator Jun 1, 2022
Comment on lines +590 to +596
ctx, collection := setup(t)

_, err := collection.InsertMany(ctx, []any{
bson.D{{"_id", "1"}, {"name", "alex"}, {"phone", "9012345678"}},
bson.D{{"_id", "2"}, {"name", "bob"}},
})
require.NoError(t, err)
Copy link
Member

Choose a reason for hiding this comment

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

I think that it becomes a problem that, unlike find tests, each update test uses its own data set. Let's put that PR on pause until we decide if we want to do something about that. Created #674 for tracking

Copy link
Member

Choose a reason for hiding this comment

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

Let's hook into update_field_compat_test.go instead of using test-specific data set

@fenogentov fenogentov marked this pull request as draft June 1, 2022 10:30
@fenogentov fenogentov changed the title Support $rename field update operator Support $rename field update operator Jun 2, 2022
@fenogentov fenogentov closed this Jun 3, 2022
@fenogentov fenogentov deleted the issue-626-rename branch June 3, 2022 05:27
@fenogentov fenogentov restored the issue-626-rename branch October 1, 2022 17:57
@fenogentov fenogentov reopened this Oct 1, 2022
@vercel
Copy link

vercel bot commented Oct 1, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
ferret-db ❌ Failed (Inspect) Oct 1, 2022 at 5:58PM (UTC)

@vercel vercel bot temporarily deployed to Preview October 1, 2022 17:58 Inactive
@fenogentov fenogentov marked this pull request as ready for review October 1, 2022 18:00
@fenogentov fenogentov requested a review from a team as a code owner October 1, 2022 18:00
@fenogentov fenogentov requested a review from w84thesun October 1, 2022 18:00
@AlekSi AlekSi self-requested a review October 2, 2022 08:27
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.

Please also resolve merge conflicts

Comment on lines +590 to +596
ctx, collection := setup(t)

_, err := collection.InsertMany(ctx, []any{
bson.D{{"_id", "1"}, {"name", "alex"}, {"phone", "9012345678"}},
bson.D{{"_id", "2"}, {"name", "bob"}},
})
require.NoError(t, err)
Copy link
Member

Choose a reason for hiding this comment

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

Let's hook into update_field_compat_test.go instead of using test-specific data set

@AlekSi AlekSi added the code/feature Some user-visible feature is not implemented yet label Oct 3, 2022
@@ -113,6 +113,46 @@ func UpdateDocument(doc, update *types.Document) (bool, error) {
}
}

case "$rename":
Copy link
Contributor

Choose a reason for hiding this comment

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

Please move that code to the new function processRenameFieldExpression.

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 make the necessary changes.

@rumyantseva
Copy link
Contributor

Supported in #1753.

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
None yet
Development

Successfully merging this pull request may close these issues.

Support $rename field update operator
4 participants