-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
User Story
As a driver engineer,
I want the MongoClient's cached client metadata to be internal,
So that I modify it without worrying about semver.
As a driver engineer,
I want to remove the legacy `metadata` property on the MongoClient that is no longer used in favor of the `extendedMetadata` and rename `extendedMetadata` as `metadata`,
So that I only have a single source of client metadata per mongoclient.
Background: Prior to NODE-5454, client metadata was built synchronously during options parsing and stored on the MongoClient. NODE-5454 required file access, which necessitated async code. The solution we chose was to instead cache a promise that resolves to client metadata on the MongoClient and await it where we use it (this occurs in `connect()`, which is asynchronous).
However, for whatever reason, `MongoClient.metadata` is public so we could not modify this property to change it to a promise. So, we added a field called `extendedMetadata` on the MongoClient. Now the MongoClient stores two fields:
metadata: ClientMetadata;
/** @internal */
extendedMetadata: Promise<Document>;
We currently construct these options like so:
mongoOptions.metadata = makeClientMetadata(mongoOptions);
mongoOptions.extendedMetadata = addContainerMetadata(mongoOptions.metadata).then(
undefined,
squashError
); // rejections will be handled later
As a part of this ticket we would like to:
1. remove the unused `metadata` property from the MongoClient and instead store the metadata promise as `metadata`.
2. make sure the interface `ClientMetadata` is accurate and includes container runtime fields (I don't think it does now)
3. make the ClientMetadata interface private
User Impact
- should be none, unless users are using the `metadata` property (I can't see why they would?)
Acceptance Criteria
Implementation Requirements
- Mark ClientMetadata interface as internal
- Audit the ClientMetadata metadata interface to make sure it is accurate and matches the spec. Fix any errors encountered.
- Remove the `metadata` property from the MongoClient and rename `extendedMetadata` as `metadata` on the client. (this will require a few code changes, TS should catch this. anywhere we use `extendedMetadata` needs to be updated).
- Move container metadata logic into makeClientMetadata
Testing Requirements
- Make sure existing tests pass
Documentation Requirements
- n/a
- has to be done after
-
NODE-5454 Driver Container and Kubernetes Awareness
-
- Closed
-