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

Fix _id formatting in update error messages #2711

Merged
merged 3 commits into from
May 25, 2023

Conversation

noisersup
Copy link
Member

@noisersup noisersup commented May 25, 2023

Description

In some places in update we return raw _id data from the document, which results in UTF-8 parsing when _id is the ObjectID:

test> db.values.updateMany({},{$inc:{"d":1},$push:{'e':1}})
�}ngoServerError: FThe field 'e' must be an array but is of type 'int' in document {_id: do>ZڥaI[

After this PR:

test> db.values.updateMany({},{$inc:{"d":1},$push:{'e':1}})
MongoServerError: The field 'e' must be an array but is of type 'int' in document {_id: ObjectId('646f3e5adaa51e61495b0db9')}

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.

@noisersup noisersup changed the title Fix ObjectID formatting in update error messages Fix _id formatting in update error messages May 25, 2023
@noisersup noisersup added the code/enhancement Some user-visible feature could work better label May 25, 2023
@noisersup noisersup requested review from a team, w84thesun, rumyantseva and chilagrow May 25, 2023 11:10
@noisersup noisersup marked this pull request as ready for review May 25, 2023 11:10
@noisersup noisersup requested a review from a team as a code owner May 25, 2023 11:10
@noisersup noisersup requested a review from rumyantseva May 25, 2023 11:25
@codecov
Copy link

codecov bot commented May 25, 2023

Codecov Report

Merging #2711 (591761c) into main (9da7885) will decrease coverage by 36.36%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2711       +/-   ##
===========================================
- Coverage   62.67%   26.32%   -36.36%     
===========================================
  Files         435      435               
  Lines       22378    22378               
===========================================
- Hits        14026     5890     -8136     
- Misses       7425    15882     +8457     
+ Partials      927      606      -321     
Impacted Files Coverage Δ
internal/handlers/common/update_array_operators.go 0.00% <0.00%> (-84.23%) ⬇️

... and 141 files with indirect coverage changes

Flag Coverage Δ
integration 5.02% <0.00%> (-51.05%) ⬇️
mongodb 5.02% <0.00%> (ø)
pg ?
unit 24.76% <0.00%> (-0.16%) ⬇️

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

Copy link
Contributor

@w84thesun w84thesun left a comment

Choose a reason for hiding this comment

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

Nice catch!

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:

@rumyantseva rumyantseva enabled auto-merge (squash) May 25, 2023 12:00
@rumyantseva rumyantseva merged commit d0022fb into FerretDB:main May 25, 2023
@AlekSi AlekSi added this to the v1.3.0 milestone Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/enhancement Some user-visible feature could work better
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants