-
Notifications
You must be signed in to change notification settings - Fork 244
DRIVERS-2985: Allow on-demand client metadata updates after MongoClient initialization. #1798
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple minor comments, everything else looks good! great work!
[Motor](https://www.mongodb.com/docs/drivers/motor/) wraps PyMongo, the following fields are updated to include Motor's | ||
"driver info": | ||
|
||
```typescript | ||
{ | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this white space change intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed in 5ce8b92, thanks!
appended to their respective fields, and be delimited by a `|` character. For example, when | ||
### Metadata updates after MongoClient initialization | ||
|
||
Drivers MUST provide an API that allows to append `DriverInfoOptions` to a MongoClient instance after initialization. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...that allows to append..." reads weirdly to me? not sure if its just me or not though. It's possible that my brain just isn't parsing it correctly? I think my brain wants it to be "...that allows to append..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're right, that allows to append
is not correct. Originally, it was supposed to be that allows wrapping libraries to append
.
I think my brain wants it to be "...that allows to append..."
Did you mean something like 'that allows appending' or 'that allows [users/wrapping libraries] to append'?
I currently changed it to that allows appending
to keep it more general and avoid over-specifying "users" or "wrapping libraries". Let me know what you think!
Changed in 5ce8b92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this is much better. (upon re-reading, realized my suggestion at the end makes no sense because i wrote the same thing HAHA sorry for the confusion) thanks!
|
||
## Client Metadata Update Prose Tests | ||
|
||
The driver **MAY** implement the following tests. Drivers that do not emit events for commands issued as part of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a MAY?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prose tests assume interaction via the public API. However, iff the public API is just a thin wrapper around internal components, and those components may already expose functionality to intercept commands (i.e., without requiring a backdoor), testing against internal layers may cover most functionality, assuming the public API’s interaction with the internals remains stable over time. The “MAY” implies that the implementer can choose the trade-off between the complexity of introducing a backdoor for public API prose testing vs internal component testing. I’ve removed “MAY” to avoid over-assuming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. @ShaneHarvey what do you think about this? Are these reasonable tests to require for all drivers?
Description
MongoDB’s handshake specification allows libraries and frameworks that wrap MongoDB drivers (e.g., ODMs, integrations) to append their own metadata.
However, this mechanism assumes the wrapping layer creates the
MongoClient
. When a wrapping environment instead receives a pre-createdMongoClient
(e.g., via dependency injection), there was no way to append additional metadata.Changes
This PR updates the handshake specification with the following additions:
client.driver
fields using a|
delimiter.Please complete the following before merging:
clusters, and serverless). Evergreen path of aforementioned Java driver implementation: Link