Skip to content

feat(NODE-7009): add client metadata on demand #4574

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

Merged
merged 13 commits into from
Jul 10, 2025
Merged

feat(NODE-7009): add client metadata on demand #4574

merged 13 commits into from
Jul 10, 2025

Conversation

durran
Copy link
Member

@durran durran commented Jul 2, 2025

Description

Allows appending driver info for the client metadata after a mongo client has been constructed.

What is changing?

  • Adds appendMetadata to MongoClient
  • Adds the ability for certain metadata to be modified on the client instance.
  • Allows for appending metadata multiple times for the handshake.
  • Syncs unified tests allowing for new functionality.
  • Updates prose handshake tests.
Is there new documentation needed for these changes?

Manual docs.

What is the motivation for this change?

NODE-7009

Release Highlight

New appendMetadata API allows clients to add handshake metadata post construction

Driver information such as name, version, and platform are allowed:

import { MongoClient } from 'mongodb';

const client = new MongoClient(process.env.MONGODB_URI);
client.appendMetadata({ name: 'my library', version: '1.0', platform: 'NodeJS' });

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

@durran durran marked this pull request as ready for review July 6, 2025 18:53
@durran durran requested a review from a team as a code owner July 6, 2025 18:53
@dariakp dariakp self-assigned this Jul 7, 2025
@dariakp dariakp added the Primary Review In Review with primary reviewer, not yet ready for team's eyes label Jul 7, 2025
@durran durran requested a review from dariakp July 8, 2025 15:25
Copy link
Contributor

@dariakp dariakp left a comment

Choose a reason for hiding this comment

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

just a couple of small things left (also see comment on open thread)

@durran durran requested a review from dariakp July 10, 2025 14:43
@dariakp dariakp merged commit b9636ee into main Jul 10, 2025
29 of 31 checks passed
@dariakp dariakp deleted the NODE-7009 branch July 10, 2025 21:44
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.

2 participants