Skip to content

feat: add MongoDB client metadata (backport #4230 to 2.4.x)#4235

Closed
evanchooly wants to merge 1 commit into2.4.xfrom
backport-4230-2.4.x
Closed

feat: add MongoDB client metadata (backport #4230 to 2.4.x)#4235
evanchooly wants to merge 1 commit into2.4.xfrom
backport-4230-2.4.x

Conversation

@evanchooly
Copy link
Copy Markdown
Member

Summary

  • Backports Add MongoDriverInformation to identify Morphia client connections #4230 to the 2.4.x branch
  • Adds MongoDriverInformation with Morphia name/version to the MongoDB client metadata on datastore construction
  • Since driver 4.x does not expose appendMetadata() (a 5.6+ API), the implementation uses reflection to reach the internal getCluster() -> getClientMetadata() -> append() chain
  • Fails silently on driver 4.x (where getClientMetadata() does not exist on Cluster); will succeed if this branch is ever upgraded to driver 5.6+

Test plan

  • Verify compilation succeeds on driver 4.x

🤖 Generated with Claude Code

Backports #4230 to the 2.4.x branch. Since driver 4.x does not expose
appendMetadata(), the implementation uses reflection to reach the
internal getCluster() -> getClientMetadata() -> append() chain, which
will succeed on driver 5.6+ and fail silently on earlier versions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@evanchooly
Copy link
Copy Markdown
Member Author

none of the methods needed exist on the driver versions here

@evanchooly evanchooly closed this Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant