I've been trying for some time to put some 'cool' things I've been reading about noSQL (couchDB, mongoDB, Redis...) in the past years into practical use.
I'm quite used to writing apps with Django, and started using Play! when Java is the only acceptable deployment option (and enjoying it too). Both have modules to work, for instance, with MongoDB, and django also has nonrel. But i never felt a need for noSQL.
Until I finally found what I thought was a good use case for document-oriented storage, such as MongoDB.
Use Case
Let's say we have to manage ordering and follow up (whatever) of some complex items. The items might have a lot of different properties, eg. oversimplifying we could have:
- a Fridge that can have
- one or two doors,
- be of class A,B or C,
- a surface color
- standalone or built-in
- an Oven that can 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 constrained by type.
In my usual RDBMS through an ORM I would go with defining a "product" model, then inherit two models, a Fridge and an Oven. If a Fridge gets one more property some time after, I modify the model - and as such, the schema-, run a migration, and add a column.
noSQL solutions
noSQL solutions I can think of are:
- using RDF (with something like Virtuoso or building my own simplified triples storage)
- using a document-oriented db such as MongoDB
The Problem
But I fail at understanding how different (easier) development would pragmatically be switching to a noSQL solution still using the framework ORM with the right adapter (especially with DODB).
Let's say I'm using Django with MongoDB through mongodb-engine.
I'm still using the same ORM, so I still describe those objects as models, listing all properties. The ORM is thus doing exactly the same job! The cost of producing a migration if the model changes is very limited with an ORM (in particular with something like South), nothing requiring to learn a new technology by itself.
There might be /other/ advantages to a DODB, and some specific to MongoDB (scalability, data-processing, maybe performance) but... what about the exact use case and problem I'm describing?
I am most likely missing a point, so here come the real question(s):
For this specific use case:
- is this example a good or bad one for DODB (do you have a good one)?
- would it make sense to combine an ORM for basic stuff (Users, Orders) and usage of noSQL without ORM for complex objects, is there a compelling reason to switch to noSQL completely, or should I stay with the stock ORM/SQL?
I understand answering these questions could be partially subjective, so you can assume perfect knowledge of both noSQL and SQL theory, and stock ORM; existence of good bridges from stock ORMs to noSQL DB. Let's assume we are talking about this use case with MongoDB as noSQL alternative.
But there is a more general question - which is the core question of this SO post:
- Isn't a good ORM (such as JPA, ActiveRecord, or Django's one) making noSQL and in particular document-oriented databases of little use?
- ...and is it worth using noSQL with a 'classic' ORM?
("little use" from a programming and maintenance standpoint, performance and similar criteria are a different matter and would require a precise product-to-product comparison)
[edit]
What I am also trying to understand is if it wouldn't be better to drop using an ORM when switching to noSQL. It would be nice to have more "dynamic" models, eg. I could have a table describing what the Fridge and Oven models are (fields), and the Fridge and Oven models in the code would be able to construct their views dynamically (forms for editing and listings for displaying).
Related questions:
[edit]: these are here to show my research, but also to clarify that what I am asking is not generic about noSQL vs. SQL
- Is an ORM redundant with a NoSQL API? : similar! but I am trying to see why most frameworks (see above) are providing noSQL access through their ORMs. Is that a good idea or not?
- why the use of an ORM with NoSql (like MongoDB) : more specific than the previous one, but still is the other way around. I'm arguing that ORMs make noSQL unuseful, rather than the other way around!
- When to replace RDBMS/ORM with NoSQL
- When to use MongoDB or other document oriented database systems?
- https://softwareengineering.stackexchange.com/questions/54373/when-would-someone-use-mongodb-or-similar-over-traditional-rdms
EDIT And links: