Official MongoDB driver for Node.js, maintained by MongoDB Inc. Current stable version is 7.2.0 (released 2025-08-13). Requires Node.js >=20.19.0 and ESM-only since v7. Regularly released every few months, with LTS versions supported for 3 years. Key differentiators: directly integrates with MongoDB protocol, supports connection pooling, transactions, change streams, and modern authentication (AWS IAM, OIDC). Users migrating from v6 must update imports and Node.js version.
npm install mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to MongoDB, inserts a document and finds it. Uses async/await and proper cleanup.
Migrate to ESM (type:'module' in package.json) or use dynamic import.
Update your Node.js to 20.19.0 or later.
Use 'serverHeartbeatSucceeded', 'serverHeartbeatFailed', 'serverHeartbeatStarted' events.
Install a compatible version: npm install mongodb-client-encryption@~7.0.0
Always await client.connect() before database operations.
Remove these options from connection URI.
Use `new ObjectId()` instead of `ObjectId()` (though it may work due to legacy, best to use `new`).
Ensure you await client.connect() before any database operations.
Use ESM import and always use new MongoClient(uri).
Start mongod or update the connection URI to point to a running instance.
This is a Mongoose warning, not driver. Update Mongoose or ignore.