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(NODE-6355): respect utf8 validation options when iterating cursors #4214

Merged
merged 10 commits into from
Sep 4, 2024

Conversation

baileympearson
Copy link
Contributor

@baileympearson baileympearson commented Aug 30, 2024

Description

What is changing?

This PR ensures that any BSON utf8 validation options are provided to the deserializer when deserializing cursors.

Since on-demand BSON, cursors are deserialized on-demand. Documents are pulled out of the cursor using MongoDBResponse.get(), which returns an unparsed on-demand document. We then deserialize it using toObject().

However, although MongoDBResponse correctly applies BSON utf8 options to its deserialization logic, the on-demand document does not. This results in documents retrieved from a cursor being deserialized without the utf8 validation options.

Is there new documentation needed for these changes?

What is the motivation for this change?

Release Highlight

Fill in title or leave empty for no highlight

Double check the following

  • Ran npm run check:lint script
  • Self-review completed using the steps outlined here
  • PR title follows the correct format: type(NODE-xxxx)[!]: description
    • Example: feat(NODE-1234)!: rewriting everything in coffeescript
  • Changes are covered by tests
  • New TODOs have a related JIRA ticket

@baileympearson baileympearson changed the title wip - fix utf8 validation for cursors fix(NODE-6355): respect utf8 validation options when iterating cursors Aug 30, 2024
@baileympearson baileympearson marked this pull request as ready for review August 30, 2024 21:01
@nbbeeken nbbeeken added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Aug 30, 2024
@nbbeeken nbbeeken self-assigned this Aug 30, 2024
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

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

The c3a9 condition is failing. Perhaps we need to be a bit more robust, searching for c3a9 after finding "insert" or "documents" so we know we're in the command.

@jia-zhen
Copy link

jia-zhen commented Sep 4, 2024

Please update and release it as soon as possible, as we are currently troubled by this issue.

.evergreen/install-mongodb-client-encryption.sh Outdated Show resolved Hide resolved
src/cmap/wire_protocol/on_demand/document.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@nbbeeken nbbeeken left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Primary Review In Review with primary reviewer, not yet ready for team's eyes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants