A wrapper around the official MongoDB Node.js driver that adds back optional callback support, intended to help projects migrate incrementally from callbacks to promises/async-await. The main mongodb driver dropped optional callbacks in v5. This package (v6.1.3) wraps mongodb v6, is actively maintained, ships TypeScript types, and requires Node >=16.20.1. It uses a caret semver range on mongodb to automatically pull in minor/patch updates. Performance penalty is minimal but present. Not recommended for new projects; use the native driver directly.
npm install mongodb-legacyNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates connecting to MongoDB using mongodb-legacy, performing a findOne operation with both callback and promise styles.
Use either callback or promise, not both.
Use .then()/.catch() or util.callbackify for new APIs.
Manually edit lockfile if specific mongodb version is needed.
Change import to 'mongodb-legacy'.
Either await the call or pass a callback function.
Run 'npm install mongodb-legacy'.