|
| 1 | +========================= |
| 2 | +ORMs, ODMs, and Libraries |
| 3 | +========================= |
| 4 | + |
| 5 | +.. facet:: |
| 6 | + :name: genre |
| 7 | + :values: reference |
| 8 | + |
| 9 | +.. meta:: |
| 10 | + :description: MongoDB has ORMs, ODMs, and Libraries to simplify interactions between your app and cluster. Use the best database for Ruby, Python, Java, C#, Node.js, PHP. |
| 11 | + :keywords: Object Oriented, abstraction, serialization, relational, |
| 12 | + |
| 13 | +.. contents:: On this page |
| 14 | + :local: |
| 15 | + :backlinks: none |
| 16 | + :depth: 1 |
| 17 | + :class: twocols |
| 18 | + |
| 19 | + |
| 20 | +`MongoDB Drivers <https://www.mongodb.com/docs/drivers/>`__ offer idiomatic APIs |
| 21 | +and helpers for most programming languages, but some applications are suited to higher level |
| 22 | +abstraction. In particular, developers may be used to interacting with data in a |
| 23 | +more declarative fashion, for example by using ActiveRecord for Ruby. `Object-Relational Mappers |
| 24 | +<https://en.wikipedia.org/wiki/Object%E2%80%93relational_mapping>`__ (or ORMs) |
| 25 | +can improve the developer experience customizing database interactions in the |
| 26 | +following ways: |
| 27 | + |
| 28 | +* Abstracting away the need for query language. |
| 29 | +* Managing serialization/deserialization of data into objects. |
| 30 | +* Enforcing schema requirements. |
| 31 | + |
| 32 | +Because MongoDB is a non-relational database management system, ORMs are |
| 33 | +sometimes referred to as ODMs (Object Document Mappers), but the terms can be |
| 34 | +used interchangeably in the MongoDB domain. MongoDB, our |
| 35 | +`community |
| 36 | +<https://www.mongodb.com/docs/drivers/community-supported-drivers/>`__, and our |
| 37 | +partners provide several ODM libraries. |
| 38 | + |
| 39 | +The following are some examples of the best MongoDB ODM libraries for a number |
| 40 | +of programming languages, including Ruby, Python, Java, C#, Node.js, and PHP. |
| 41 | + |
| 42 | +Ruby |
| 43 | +---- |
| 44 | + |
| 45 | +Mongoid |
| 46 | +~~~~~~~ |
| 47 | + |
| 48 | +The Mongoid ODM provides API parity with Rails wherever possible to ensure |
| 49 | +developers that are used to working with a `Ruby on Rails |
| 50 | +<https://rubyonrails.org/>`__ framework can use the methods and mechanics |
| 51 | +they’re already familiar with in ActiveRecord. |
| 52 | + |
| 53 | +See the `Mongoid documentation |
| 54 | +<https://www.mongodb.com/docs/mongoid/current/>`__ for more information. |
| 55 | + |
| 56 | +Python |
| 57 | +------ |
| 58 | + |
| 59 | +Beanie |
| 60 | +~~~~~~ |
| 61 | + |
| 62 | +Beanie is a third-party, asynchronous Python ODM based on `Pydantic |
| 63 | +<https://pydantic-docs.helpmanual.io/>`__. Beanie uses corresponding documents |
| 64 | +to interact with each database collection, and supports adding, updating, and |
| 65 | +deleting documents. Beanie saves you time by removing boilerplate code, and it |
| 66 | +helps you focus on the parts of your app that actually matter. |
| 67 | + |
| 68 | +See the `Beanie documentation <https://beanie-odm.dev/>`__ for more information. |
| 69 | + |
| 70 | +MongoEngine |
| 71 | +~~~~~~~~~~~ |
| 72 | + |
| 73 | +MongoEngine is a third-party, synchronous Python ORM for MongoDB. It uses a |
| 74 | +simple declarative API and is built on top of the |
| 75 | +`MongoDB PyMongo Driver <https://www.mongodb.com/docs/drivers/pymongo/>`__. |
| 76 | + |
| 77 | +See the `MongoEngine documentation <https://mongoengine-odm.readthedocs.io/>`__ |
| 78 | +for more information. |
| 79 | + |
| 80 | +Django |
| 81 | +~~~~~~ |
| 82 | + |
| 83 | +Django MongoDB Backend is the official MongoDB integration for Django and |
| 84 | +MongoDB. This integration supports many core Django features, including the |
| 85 | +Django ORM. It translates Django ORM methods into equivalent MongoDB queries, |
| 86 | +allowing developers to use the familiar Django interface. |
| 87 | + |
| 88 | +See the `Django MongoDB Backend documentation |
| 89 | +<https://www.mongodb.com/docs/languages/python/django-mongodb/current>`__ for |
| 90 | +more information. |
| 91 | + |
| 92 | + |
| 93 | +Java |
| 94 | +---- |
| 95 | + |
| 96 | +Spring Data MongoDB |
| 97 | +~~~~~~~~~~~~~~~~~~~ |
| 98 | + |
| 99 | +Spring Data MongoDB is a third-party Java ORM for MongoDB. The `Spring Data |
| 100 | +<https://spring.io/projects/spring-data>`__ project provides a familiar and |
| 101 | +consistent Spring-based programming model which is enhanced by |
| 102 | +MongoDB-specific features and capabilities. Spring Data MongoDB uses a |
| 103 | +POJO-centric model for interacting with collections and writing repository-style |
| 104 | +data access layers. |
| 105 | + |
| 106 | +See the `Spring Data MongoDB documentation |
| 107 | +<https://spring.io/projects/spring-data-mongodb>`__ or the `Spring Boot |
| 108 | +Integration with MongoDB Tutorial |
| 109 | +<https://www.mongodb.com/compatibility/spring-boot>`__ for more information. |
| 110 | + |
| 111 | +.. TODO: Hibernate |
| 112 | + |
| 113 | +.NET/C# |
| 114 | +------- |
| 115 | + |
| 116 | +Entity Framework |
| 117 | +~~~~~~~~~~~~~~~~ |
| 118 | + |
| 119 | +MongoDB Entity Framework Core Provider (EF Core Provider) is the official |
| 120 | +intergration for MongoDB and EF Core. It allows developers |
| 121 | +using C# in the .NET ecosystem to use `Entity Framework Core |
| 122 | +<https://learn.microsoft.com/en-us/ef/>`__ as their ODM which provides a |
| 123 | +familiar API interface, query paradigm (LINQ), and design pattern. |
| 124 | + |
| 125 | +See the `EF Core provider documentation |
| 126 | +<https://www.mongodb.com/docs/entity-framework/current/>`__ for more |
| 127 | +information. |
| 128 | + |
| 129 | +Node.js |
| 130 | +------- |
| 131 | + |
| 132 | +Mongoose |
| 133 | +~~~~~~~~ |
| 134 | + |
| 135 | +Mongoose is a third-party Node.js-based ODM library for MongoDB. It enforces a specific |
| 136 | +schema at the application layer and offers a variety of hooks, model validation, |
| 137 | +and other features. |
| 138 | + |
| 139 | +See the `Mongoose documentation <https://mongoosejs.com/>`__ or `MongoDB & |
| 140 | +Mongoose: Compatibility and Comparison |
| 141 | +<https://www.mongodb.com/developer/languages/javascript/mongoose-versus-nodejs-driver/>`__ |
| 142 | +for more information. |
| 143 | + |
| 144 | +Prisma |
| 145 | +~~~~~~ |
| 146 | + |
| 147 | +Prisma is a third-party ODM for Node.js and Typescript that fundamentally differs from |
| 148 | +traditional ORMs. It uses declarative Prisma schemas as the single |
| 149 | +source of truth for both your database schema and models. The Prisma client |
| 150 | +reads and writes data in a type-safe manner, and returns plain JavaScript objects. |
| 151 | + |
| 152 | +See `Prisma & MongoDB <https://www.prisma.io/mongodb>`__ for more information. |
| 153 | + |
| 154 | +PHP |
| 155 | +--- |
| 156 | + |
| 157 | +Doctrine |
| 158 | +~~~~~~~~ |
| 159 | + |
| 160 | +Doctrine is a third-party PHP MongoDB ODM. This library provides PHP object mapping |
| 161 | +functionality and transparent persistence for PHP objects to MongoDB, as well as |
| 162 | +a mechanism to map embedded or referenced documents. It can also create |
| 163 | +references between PHP documents in different databases and work with `GridFS |
| 164 | +buckets <https://www.mongodb.com/docs/php-library/current/write/gridfs/>`__. |
| 165 | + |
| 166 | +See the `Doctrine MongoDB ODM documentation |
| 167 | +<https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/index.html>`__ |
| 168 | +for more information. |
| 169 | + |
| 170 | +Symfony |
| 171 | +~~~~~~~ |
| 172 | + |
| 173 | +The Doctrine MongoDB ODM can be used to integrate MongoDB with |
| 174 | +the Symfony PHP framework. Doctine's object mapping enables developers to get |
| 175 | +the benefits of MongoDB features, such as flexible schema design |
| 176 | +and advanced searches, alongside Symfony's reusable components and streamlined |
| 177 | +web design. |
| 178 | + |
| 179 | +See the `Symfony MongoDB Integration page |
| 180 | +<https://www.mongodb.com/docs/drivers/php-frameworks/symfony/>`__ for more |
| 181 | +information. |
| 182 | + |
| 183 | +.. TODO? Drupal |
| 184 | + |
| 185 | +Laravel |
| 186 | +~~~~~~~ |
| 187 | + |
| 188 | +Laravel MongoDB is the official integration for MongoDB and Laravel. It extends |
| 189 | +methods in the PHP Laravel API to provide developers the full suite of Laravel's |
| 190 | +Eloquent and Query Builder features while using MongoDB as their datastore. |
| 191 | +With this package, Laravel developers can take advantage of MongoDB's flexible schema |
| 192 | +and extensive capabilities, while maintaining familiar patterns, relationships, |
| 193 | +and features such as querying, caching, and more. |
| 194 | + |
| 195 | +See the `Laravel MongoDB documentation |
| 196 | +<https://www.mongodb.com/docs/drivers/php/laravel-mongodb/current/>`__ for more |
| 197 | +information. |
0 commit comments