I tried for some time to add some “cool” things that I read about noSQL (couchDB, mongoDB, Redis ...) in recent years in practical use.
I'm pretty used to writing apps with Django and started using Play! when Java is the only acceptable deployment option (and uses it). Both modules work, for example, with MongoDB , and django also has nonrel . But I never felt the need for noSQL.
Until I finally found what, in my opinion, was a good option for storing documents like MongoDB.
Use case
Let's say we need to manage the order and keep track of any complex items. Elements can have many different properties, for example. simplification, we could:
- Refrigerator that may have
- one or two doors
- be class A, B or C,
- surface color
- standalone or built-in
- an oven that may have:
- gas or electricity or both
- self-cleaning or not
- standalone or built-in
SQL / ORM Solution
As you can see, each object can have several properties that can be limited by type.
In my regular DBMS, through ORM, I would go with the definition of the “product” model, then inherit two models: a refrigerator and an oven. If after some time the refrigerator receives another property, I change the model - and as such, the scheme, perform the migration and add the column.
noSQL solutions
noSQL solutions I can think of:
- using RDF (with something like Virtuoso or creating my own simplified triples repository)
- using a document-oriented db like MongoDB
Problem
But I don’t understand how another (simpler) development would be pragmatically switched to a noSQL solution still using the ORM framework with the right adapter (especially with DODB).
Let's say I use Django with MongoDB via mongodb-engine.
I still use the same ORM, so I still describe these objects as models, listing all the properties. Thus, ORM does exactly the same job! The cost of creating migration, if the model changes, is very limited by ORM (in particular, with something like the South), and does not require anything to independently study the new technology.
There may be / other / advantages for DODB and some specific to MongoDB (scalability, data processing, possibly performance), but ... what about the specific use case and problems that I describe?
Most likely, I will miss the point, so here is the question:
For this specific use case:
- Is this example good or bad for DODB (do you have a good one)?
- It would be wise to combine ORM for the base material (Users, Orders) and use noSQL without ORM for complex objects, is there any good reason to completely switch to noSQL or do I need to stay with ORM / SQL?
I understand that the answers to these questions may be partially subjective, so you can take on a full knowledge of the theory of noSQL and SQL and ORM stock; the presence of good bridges from exchange ORMs to the noSQL database. Suppose we are discussing this use case with MongoDB as an alternative to noSQL.
But there is a more general question, which is the main question of this SO post:
- Not a good ORM (e.g. JPA, ActiveRecord or Django), which makes noSQL and, in particular, less document-oriented databases?
- ... and is it worth using noSQL with the "classic" ORM?
(“little use” in terms of programming and maintenance, performance and similar criteria are another matter and require an accurate comparison of the product with the product).
[edit]
What I'm also trying to understand is that it is not better to refuse to use ORM when switching to noSQL. It would be nice to have more “dynamic” models, for example. I could write a table describing the models of refrigerators and ovens (fields), and the models of refrigerators and ovens in the code could dynamically build their representations (forms for editing and lists for displaying).
Related questions:
[edit] : here you can show my research, but also clarify that what I ask is not common for noSQL and SQL
EDIT AND LINKS:
- Siena : The Java persistence API, inspired by the Google App Engine Python Datastore, is trying to draw a bridge between the SQL and NoSQL worlds.
- minimongo : lightweight, schematic, Pythonic object-oriented interface for MongoDB