In the website of MongoDB they wrote that MonogDB is Document-oriented Database, so if the MongoDB is not an Object Oriented database, so what is it? and what are the differences between Document and Object oriented databases?
In the website of MongoDB they wrote that MonogDB is Document-oriented Database, so if
Share
I think doc-oriented and object-oriented databases are quite different. Fairly detailed post on this here:
http://blog.10gen.com/post/437029788/json-db-vs-odbms
*** Edit: very old blog post at this point, apparently not online anymore. So I add these comments here:
There are two big ideas in databases: (1) transactions, and (2) separating the data from the code in a system. The invention of Relational Databases in 1969 really solidified #2. In such a database typically it’s easy to inspect data without knowing anything about the application code.
We wanted to maintain that property (2) in MongoDB. So if you take an object from your program, and remove all the methods, what’s left? A "struct" would be one answer. A "document", in the sense of an XML/JSON document, would be another. That said, we don’t take this too literally: in MongoDB, one may diverge from some code snippet’s data representation to some other (document-oriented) representation.
Thus, documents are objects without code; they are often "entities", speaking loosely. There are relationships between documents of course.
In practice one often designs document schemas with a bit of a bias towards the details of the use case, rather than towards some abstract canonical notion of what is correct — when iterating on code, and trying to scale horizontally, that design pattern works pretty well.
We prefer to keep the schema of these "dynamic" in that one can optionally add additional fields; have polymorphism on fields, etc. These things all fit very well with Agile/Iterative Development and also are harmonious with non-database things such as just passing information around in large micro-services architectures.