Why use ORM with NoSql (e.g. MongoDB)

Sorry, but does that make sense? ORM means: Object Relational Mapper, and here is Relational, and NoSql is not RDBMS! so why use ORM in a NoSql solution? because I see ORM updates for Python!

+5
source share
3 answers

First, they are not ORMs (since there is no relationship between them), they are ODM (Object Document Mapper)

The main use of these ODM frameworks is the same here as some common feature of ORM, thus

  • provides an abstraction over your data model. You can use your data in your application regardless of the target software.
  • Most ODMs use existing language features and use a familiar template to manage data instead to learn the new language syntax of new software.

When I use mongoid (Ruby ODM for mongo), I can query mongo how I do it in the active model (mostly).

Since they do not have a relationship between them, these ODMs provide a way to define relationships in your models and simulate relationships. All of them are distracted from the developer, so they can encode the same as with relational data.

+8
source

ORM is the level of abstraction. Switching to another engine is much easier when requests are abstracted and hidden behind a common interface (in practice, this is not always good, but it is still simpler than without).

+2
source

Interest Ask. Although NoSQL databases do not have a mechanism for identifying relationships, this does not mean that there is no logical relationship between the data you store. In most cases, you process and apply these relationships in code manually if you use a NoSQL database.

Therefore, I feel that ORM can help you here. If you have related data but need to use a NoSQL database, ORM can still help you maintain clean data.

For example, I use Amazon SimpleDB for a lower cost, but my data still has relationships that need to be maintained. I am currently doing this manually. Maybe ORM will help me too.

+2
source

Source: https://habr.com/ru/post/902876/


All Articles