A C++ native addon for BSON serialization/deserialization, used as a faster alternative to the pure JavaScript js-bson library. Version 4.0.3 is the latest stable release, compatible with js-bson v4+ and the MongoDB Node.js driver v4+. The package has irregular release cadence and is now deprecated in favor of the pure JavaScript js-bson library, which eliminates native compilation issues and provides better cross-platform support. It is only for Node.js (not browser) and uses N-API for native bindings.
npm install bson-extNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates serialization and deserialization using deprecated bson-ext native addon with CommonJS.
Replace 'bson-ext' with 'bson' in package.json and require statements: const BSON = require('bson');Ensure all dependencies are updated to v4+.
Use js-bson which is pure JavaScript and has no native dependencies.
Use require('bson-ext') instead of import.Update serialization options to exclude removed tokens.
Rebuild bson-ext against your Node.js version: npm rebuild bson-ext or switch to 'bson'.
Install bson-ext: npm install bson-ext. Use require('bson-ext'), not import.Use const BSON = require('bson-ext'); then BSON.serialize(doc).Try npm rebuild bson-ext or switch to js-bson (bson package).