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

Allow for injection of BSON library into MongoClient

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON, Native
    • Labels:
      None

      Currently, the driver relies on the 1.x branch of BSON. It does some auto-detection to detect if bson-ext is present, and will use that instead.

      In the next major version of the driver, we will be upgrading to use BSON 4.x.

      Instead of using auto-detection logic like we do currently for bson-ext, we should allow users to provide their own BSON implementation to the MongoClient.

      Default behavior:

      // Uses BSON v4
      const client = new MongoClient(url);
      
      // Import bson-ext (will likely require a breaking version of bson-ext for this)
      const bson = require('bson-ext');
      
      // MongoClient now uses bson-ext
      const client = new MongoClient(url, { bson });
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: