ORM和ODM有什么区别?

时间:2022-04-07 13:26:52

I am trying to figure out what the difference is between ORM and ODM, as far as I understand the concept, ORM (Object Relational Mapper) maps the relations between data, where as ODM (Object Document Mapper) deals with documents. Am I right in assuming that mySQL is an example of ORM and MongoDB is a example of ODM?

我正在尝试弄清楚ORM和ODM之间的区别,就我所理解的概念而言,ORM(对象关系映射器)映射了数据之间的关系,其中ODM(对象文档映射器)处理文档。假设mySQL是ORM的一个例子,MongoDB就是一个ODM的例子,这是正确的吗?

As I am sure you can see, I am not too familiar with the theory of the concept. Could someone please clarify the differences between the two?

我相信你们可以看到,我对概念的理论不是很熟悉。谁能解释一下这两者之间的区别吗?

3 个解决方案

#1


121  

MySQL is an example of a relational database - you would use an ORM to translate between your objects in code and the relational representation of the data.

MySQL是关系数据库的一个例子——您可以使用ORM在代码中的对象和数据的关系表示之间进行转换。

Examples of ORMs are nHibernate, Entity Framework, Dapper and more...

orm的例子有nHibernate、实体框架、Dapper等等。

MongoDB is an example of a document database - you would use an ODM to translate between your objects in code and the document representation of the data (if needed).

MongoDB是一个文档数据库的例子——您可以使用ODM在代码中的对象和数据的文档表示之间进行转换(如果需要的话)。

Mandango is an example of an ODM for MongoDB.

Mandango是MongoDB的一个ODM的例子。

#2


17  

An ORM maps between an Object Model and a Relational Database. An ODM maps between an Object Model and a Document Database. MySQL is not an ORM, it's a Relational Database, more specifically, a SQL Database. MongoDB is not an ODM, it's a Document Database.

ORM映射对象模型和关系数据库之间。ODM映射对象模型和文档数据库。MySQL不是ORM,而是关系数据库,更具体地说,是SQL数据库。MongoDB不是ODM,而是一个文档数据库。

#3


8  

Essencially, an ORM use a SQL database Driver like ODBC, JDBC or OLEDB to translate the object notation to relational notation and an ODM use a JSON or JSONB api to translate the Object notation to Document notation.

本质上,ORM使用SQL数据库驱动程序,如ODBC、JDBC或OLEDB将对象表示法转换为关系符号,而ODM使用JSON或JSONB api将对象表示法转换成文档标记。

There are different kind of implementations under the hood.

在引擎盖下有不同类型的实现。

PS: JSONB is a JSON text document notation stored in a binary format as used by MongoDB.

JSONB是一种JSON文本文档符号,存储为MongoDB的二进制格式。

#1


121  

MySQL is an example of a relational database - you would use an ORM to translate between your objects in code and the relational representation of the data.

MySQL是关系数据库的一个例子——您可以使用ORM在代码中的对象和数据的关系表示之间进行转换。

Examples of ORMs are nHibernate, Entity Framework, Dapper and more...

orm的例子有nHibernate、实体框架、Dapper等等。

MongoDB is an example of a document database - you would use an ODM to translate between your objects in code and the document representation of the data (if needed).

MongoDB是一个文档数据库的例子——您可以使用ODM在代码中的对象和数据的文档表示之间进行转换(如果需要的话)。

Mandango is an example of an ODM for MongoDB.

Mandango是MongoDB的一个ODM的例子。

#2


17  

An ORM maps between an Object Model and a Relational Database. An ODM maps between an Object Model and a Document Database. MySQL is not an ORM, it's a Relational Database, more specifically, a SQL Database. MongoDB is not an ODM, it's a Document Database.

ORM映射对象模型和关系数据库之间。ODM映射对象模型和文档数据库。MySQL不是ORM,而是关系数据库,更具体地说,是SQL数据库。MongoDB不是ODM,而是一个文档数据库。

#3


8  

Essencially, an ORM use a SQL database Driver like ODBC, JDBC or OLEDB to translate the object notation to relational notation and an ODM use a JSON or JSONB api to translate the Object notation to Document notation.

本质上,ORM使用SQL数据库驱动程序,如ODBC、JDBC或OLEDB将对象表示法转换为关系符号,而ODM使用JSON或JSONB api将对象表示法转换成文档标记。

There are different kind of implementations under the hood.

在引擎盖下有不同类型的实现。

PS: JSONB is a JSON text document notation stored in a binary format as used by MongoDB.

JSONB是一种JSON文本文档符号,存储为MongoDB的二进制格式。