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-3574): reintroduce ObjectID export #2965

Merged
merged 5 commits into from
Sep 7, 2021
Merged

Conversation

nbbeeken
Copy link
Contributor

Reintroduced the capitalized ObjectID export along with a deprecation tag.

@nbbeeken nbbeeken marked this pull request as ready for review September 1, 2021 15:19
@nbbeeken nbbeeken requested a review from emadum September 1, 2021 15:19
Copy link
Contributor

@emadum emadum left a comment

Choose a reason for hiding this comment

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

I'm not sure my suggested approach for tsd is the ideal one but it seems to work.

@@ -15,6 +16,8 @@ expectDeprecated(Collection.prototype.count);
expectDeprecated(AggregationCursor.prototype.geoNear);
expectDeprecated(Topology.prototype.unref);
expectDeprecated(Db.prototype.unref);
// expectDeprecated(ObjectID); // not sure why tsd can't assert the deprecation
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is because it's root level. I tried this out and it worked:

import * as AllExports from '../../src';
expectDeprecated(AllExports.ObjectID);
expectNotDeprecated(AllExports.ObjectId);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perfect, that works!

@nbbeeken nbbeeken requested a review from emadum September 1, 2021 15:45
it('should include ObjectID', () =>
expect(mongodb).to.have.property('ObjectID').that.is.a('function'));
it('should have ObjectID and ObjectId equal each other', () =>
expect(mongodb.ObjectId).to.deep.equal(mongodb.ObjectID));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be just regular equal since we're actually expecting reference equality?

Suggested change
expect(mongodb.ObjectId).to.deep.equal(mongodb.ObjectID));
expect(mongodb.ObjectId).to.equal(mongodb.ObjectID));

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I don't think there should be any package lock changes for this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Lock file changes fixed, and no longer checking deep equality 🚀

@dariakp dariakp merged commit 2291119 into 4.1 Sep 7, 2021
@dariakp dariakp deleted the NODE-3574/ObjectID branch September 7, 2021 21:22
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.

3 participants