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

Upgrade to BSON v6 #6561

Open
kraenhansen opened this issue Mar 18, 2024 · 3 comments · May be fixed by #6593
Open

Upgrade to BSON v6 #6561

kraenhansen opened this issue Mar 18, 2024 · 3 comments · May be fixed by #6593
Labels
First-Good-Issue First Good Issue - Relatively easy issue for new contributers

Comments

@kraenhansen
Copy link
Member

The public types emitted for bson.d.ts are wrong:

export declare namespace BSON {
    const ObjectId: typeof bson.ObjectID; // 👈 notice the capital D in ID
    type ObjectId = bson.ObjectId;
    const ObjectID: typeof bson.ObjectID;
    type ObjectID = bson.ObjectID;
    // ...
}

This is really weird since we're importing the right type from the namespace:

export const ObjectId = bson.ObjectId;
export type ObjectId = bson.ObjectId;
export const ObjectID = bson.ObjectID;
export type ObjectID = bson.ObjectID;

We should be able to upgrade to bson@6 by now and this will fix the issue since that has removed ObjectID (capital D) entirely.

@kraenhansen kraenhansen added the First-Good-Issue First Good Issue - Relatively easy issue for new contributers label Mar 18, 2024
Copy link

sync-by-unito bot commented Mar 18, 2024

➤ PM Bot commented:

Jira ticket: RJS-2765

@elle-j
Copy link
Contributor

elle-j commented Apr 12, 2024

Adding the same notes as in the corresponding PR description regarding being blocked:

The BSON package is currently using top-level await which currently prevents us from bundling if don't enable that feature. @kraenhansen has contributed a PR to BSON to alleviate this for us (see Jira ticket).

@kraenhansen
Copy link
Member Author

@elle-j and I looked further into this last week and realized:

  1. bson@6 is relying soly on exports conditions to expose its React Native bundle: https://github.com/mongodb/js-bson/blob/c58d1e213714c99bbb09d0f91a3c9199e43710dd/package.json#L90. This problematic, because Metro is currently considering its ability to resolve using exports conditions "experimental" and its disabled by default.
  2. The way the base64 dependency is required by the React Native bundle, confuses Metro. We need to investigate this further, but our current suspicion is the use of a "sub-package" / "bundled dependency", in the sense that the vendored "base64" is resolved via a "package.json" which is included in a sub-directory of the "bson" package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-Good-Issue First Good Issue - Relatively easy issue for new contributers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants