TypeScript ORM for Node.js that gives type-safe database access across PostgreSQL, MySQL, SQLite, MongoDB and other databases.
mongodb/node-mongodb-native
The official MongoDB driver for Node.js and TypeScript, used to connect to MongoDB and run queries from application code.
- Stars
- 10,171
- Forks
- 1,822
- Open issues
- 29
- Last commit
- yesterday
What is it?
The mongodb package is the official Node.js driver for MongoDB. It lets JavaScript and TypeScript applications connect to a MongoDB server and perform CRUD operations, aggregations, indexing, and other database commands through a promise-based API.
The driver ships with TypeScript types and targets servers from 4.4 onward. It supports optional add-on packages for zstd and snappy network compression, client-side field level and queryable encryption, and Kerberos or AWS authentication. Releases follow semantic versioning and are published to npm with provenance attestations and GPG-signed packages.
The project is maintained by MongoDB and documented in the official driver docs and API reference. A separate mongodb-legacy package is listed for compatibility with older driver APIs.
Key features
- 01Promise-based CRUD, aggregation, and index APIs for MongoDB.
- 02Bundled TypeScript type definitions.
- 03Optional zstd and snappy network compression.
- 04Client-side field level and queryable encryption via add-on package.
- 05Kerberos (GSSAPI/SSPI) and AWS authentication support.
- 06Semantic versioning with signed releases and npm provenance.
Use cases
- Building a Node.js backend that stores and queries data in MongoDB.
- Adding MongoDB access to a TypeScript project.
- Running encrypted or compressed connections to MongoDB from Node.js services.
Quick start
- 1
Create a project directory and initialize it with npm
npm init -y - 2
Install the MongoDB driver
npm install mongodb - 3
Start a MongoDB server (install mongod from the MongoDB downloads page first)
mongod --dbpath=/data - 4
Create app.js with the connection code and run it
node app.js
Things to know
- Requires a running MongoDB server, which you must install and start separately.
- Driver requires MongoDB 4.4+ servers.
Topics
FAQ
- What is node-mongodb-native?
- The official MongoDB driver for Node.js and TypeScript, used to connect to MongoDB and run queries from application code. The mongodb package is the official Node.js driver for MongoDB. It lets JavaScript and TypeScript applications connect to a MongoDB server and perform CRUD operations, aggregations, indexing, and other database commands through a promise-based API.
- Is node-mongodb-native free to use? What license does it have?
- node-mongodb-native is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is node-mongodb-native still maintained?
- Actively maintained. The last commit to node-mongodb-native was on Oct 20, 2026.
- What can I use node-mongodb-native for?
- Building a Node.js backend that stores and queries data in MongoDB. Adding MongoDB access to a TypeScript project. Running encrypted or compressed connections to MongoDB from Node.js services.
- How do I install node-mongodb-native?
- Create a project directory and initialize it with npm: npm init -y Install the MongoDB driver: npm install mongodb Start a MongoDB server (install mongod from the MongoDB downloads page first): mongod --dbpath=/data Create app.js with the connection code and run it: node app.js
- Where can I get node-mongodb-native?
- The source code and installation instructions are on GitHub: https://github.com/mongodb/node-mongodb-native
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
TypeScript ORM for Node.js built on Data Mapper, Unit of Work and Identity Map patterns, supporting SQL and MongoDB.
A TypeScript and JavaScript ORM for Node.js and other JS platforms, supporting both Active Record and Data Mapper patterns across many SQL and NoSQL databases.
MongoDB, the source-available document database server (mongod) with the mongos sharding router, written in C++.
MongoDB object modeling for Node.js, providing schemas, models, validation, and query helpers for async applications.
A multi-model database written in Rust that combines document, graph, relational, time-series, and key-value data with realtime queries and built-in access control.