Docs Menu
Docs Home
/
Drivers
/

ORMs, ODMs, and Libraries

On this page

  • Ruby
  • Python
  • Java
  • .NET/C#
  • Node.js
  • PHP

MongoDB Drivers offer idiomatic APIs and helpers for most programming languages, but some applications are suited to higher level abstraction. In particular, developers may be used to interacting with data in a more declarative fashion, for example by using ActiveRecord for Ruby. Object-Relational Mappers (or ORMs) can improve the developer experience customizing database interactions in the following ways:

  • Abstracting away the need for query language.

  • Managing serialization/deserialization of data into objects.

  • Enforcing schema requirements.

Because MongoDB is a non-relational database management system, ORMs are sometimes referred to as ODMs (Object Document Mappers), but the terms can be used interchangeably in the MongoDB domain. MongoDB, our community, and our partners provide several ODM libraries.

The following are some examples of the best MongoDB ODM libraries for a number of programming languages, including Ruby, Python, Java, C#, Node.js, and PHP.

The Mongoid ODM provides API parity with Rails wherever possible to ensure developers that are used to working with a Ruby on Rails framework can use the methods and mechanics they’re already familiar with in ActiveRecord.

See the Mongoid documentation for more information.

Beanie is a third-party, asynchronous Python ODM based on Pydantic. Beanie uses corresponding documents to interact with each database collection, and supports adding, updating, and deleting documents. Beanie saves you time by removing boilerplate code, and it helps you focus on the parts of your app that actually matter.

See the Beanie documentation for more information.

MongoEngine is a third-party, synchronous Python ORM for MongoDB. It uses a simple declarative API and is built on top of the MongoDB PyMongo Driver.

See the MongoEngine documentation for more information.

Django MongoDB Backend is the official MongoDB integration for Django and MongoDB. This integration supports many core Django features, including the Django ORM. It translates Django ORM methods into equivalent MongoDB queries, allowing developers to use the familiar Django interface.

See the Django MongoDB Backend documentation for more information.

Spring Data MongoDB is a third-party Java ORM for MongoDB. The Spring Data project provides a familiar and consistent Spring-based programming model which is enhanced by MongoDB-specific features and capabilities. Spring Data MongoDB uses a POJO-centric model for interacting with collections and writing repository-style data access layers.

See the Spring Data MongoDB documentation or the Spring Boot Integration with MongoDB Tutorial for more information.

MongoDB Entity Framework Core Provider (EF Core Provider) is the official intergration for MongoDB and EF Core. It allows developers using C# in the .NET ecosystem to use Entity Framework Core as their ODM which provides a familiar API interface, query paradigm (LINQ), and design pattern.

See the EF Core provider documentation for more information.

Mongoose is a third-party Node.js-based ODM library for MongoDB. It enforces a specific schema at the application layer and offers a variety of hooks, model validation, and other features.

See the Mongoose documentation or MongoDB & Mongoose: Compatibility and Comparison for more information.

Prisma is a third-party ODM for Node.js and Typescript that fundamentally differs from traditional ORMs. It uses declarative Prisma schemas as the single source of truth for both your database schema and models. The Prisma client reads and writes data in a type-safe manner, and returns plain JavaScript objects.

See Prisma & MongoDB for more information.

Doctrine is a third-party PHP MongoDB ODM. This library provides PHP object mapping functionality and transparent persistence for PHP objects to MongoDB, as well as a mechanism to map embedded or referenced documents. It can also create references between PHP documents in different databases and work with GridFS buckets.

See the Doctrine MongoDB ODM documentation for more information.

The Doctrine MongoDB ODM can be used to integrate MongoDB with the Symfony PHP framework. Doctine's object mapping enables developers to get the benefits of MongoDB features, such as flexible schema design and advanced searches, alongside Symfony's reusable components and streamlined web design.

See the Symfony MongoDB Integration page for more information.

Laravel MongoDB is the official integration for MongoDB and Laravel. It extends methods in the PHP Laravel API to provide developers the full suite of Laravel's Eloquent and Query Builder features while using MongoDB as their datastore. With this package, Laravel developers can take advantage of MongoDB's flexible schema and extensive capabilities, while maintaining familiar patterns, relationships, and features such as querying, caching, and more.

See the Laravel MongoDB documentation for more information.

Back

Azure Cosmos DB Compatibility