Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4701

Remove BSON default export

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • bson-5.0.0
    • Affects Version/s: None
    • Component/s: None
    • 3
    • Not Needed
    • Not Needed

      Use Case

      BSON should have consistent exports across module types (esm, cjs). The ideal way to offer the same style of export across modules is with using named exports only.

      User Impact

      • Migration will require code changes
        • Users using webpack (which can be node or web users) may be pulling the esm compiled version of the BSON library and they will no longer have a default export to import from.
        • It will lead to a runtime (perhaps bundle time) error.
      • Any usage of import BSON from 'bson' would need to be changed to import {BSON} from 'bson'.

      Dependencies

      • BSON library

      Unknowns

      • None

      Acceptance Criteria

      Implementation Requirements

      • Change export default BSON; to export const BSON in bson.ts
      • Remove the deprecation attached to this variable

      Testing Requirements

      • Add unit tests much like the ones in unit/index.test.ts in the driver
        • Should assert that all the current exports are present on require('bson')
        • Should assert that all the current exports are also available on require('bson').BSON

            Assignee:
            neal.beeken@mongodb.com Neal Beeken
            Reporter:
            neal.beeken@mongodb.com Neal Beeken
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: