por qué el uso de un ORM con NoSql (como MongoDB) [cerrado]

sorry, but does this make sense? the ORM means: Object Relational Mapper, and here, there is Relational, and NoSql is not RDBMS! so why the use of an ORM in a NoSql solution? because i see updates of ORMs for Python!

preguntado el 08 de noviembre de 11 a las 14:11

because 1- it's the lonly language i know 2- because the orm is made for a specific language?! -

3 Respuestas

Firstly, they are not ORM (since they don't have any relations among them), they are ODM (Object Document Mapper)

Main usage of these ODM frameworks here same as the some common feature of ORM, thus

  • providing the abstraction over your data model. you can have your data modelled in your application irrespective of the target software.
  • Most ODM's build to leverage the existing language features and use the familiar pattern to manipulate data instead to learn new language syntax's of the new software.

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

Since they don't have the relation among them, these ODM's provide the way to define the relations in your models and simulate the relationships. These are all abstracted from the developer so they can code the same way they do with the relational data.

respondido 16 nov., 11:13

but about the second point: "Most ODM's build to leverage the existing language features and use the familiar pattern to manipulate data instead to learn new language syntax's of the new software." it is the job of the Driver no? - Abdelouahab

No, drivers just provide a backbone to call the underlying engine to access the data. Java driver to the mysql and hibernate ORM are totally different right? same way its different in Non sql too..Mongoid ODM uses Ruby mongodb driver to talk to mongodb.. - RameshVel

am confused here, because the driver uses the same language and can do the MongoDB stuff in the language's way (pymongo will use python's insctruction to use the database, for example the Dictionnary) - Abdelouahab

there is nothing to get confused here, you can still use driver to access the data, there is no problem with that. Assume in a relational word before the ORM drivers, we use legacy drivers (in any language) to access the data from the databases by passing the string query(its a sql synatx). Same way when you are using driver you have to pass mongodb queries as string input to your drivers. But when you use ODM, its all taken care for you - RameshVel

so now i'll start with MiniMongo slacy.com/blog/2011/01/… - Abdelouahab

ORM is an abstraction layer. Switching to a different engine is much easier when the queries are abstracted away, and hidden behind a common interface (it doesn't always work that well in practice, but it's still easier than without).

respondido 08 nov., 11:18

but that was efficient when it was the SQL era, no? - Abdelouahab

@abdel: You mean the "era" that never really ended? - Gato Plus Plus

Interesting question. Although NoSQL databases do not have a mechanism to identify relationships, it does not mean that there are no logical relationships between the data that you are storing. Most of the time, you are handling & enforcing those relationships in code manually if you're using a NoSQL database.

Hence, I feel that ORMs can still help you here. If you do have data that is related, but need to use a NoSQL database, an ORM can still help you in maintaining clean data.

Por ejemplo, I use Amazon SimpleDB for the lower cost, but my data still has relationships, which need to be maintained. Currently, I'm doing that manually. Maybe an ORM would help me as well.

respondido 08 nov., 11:18

so that's used for inheritance? but if the NoSql solution has the tool to identify relations, will it be useful to use the ORM? - Abdelouahab

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.