I have read many articles online but each one of them fail to give even a basic example on how an Object Oriented Database is stored and represented. For example each of the articles say that they are not tables, but are objects and then provide an ER Diagram with arrows pointing between them, for example, wikipedia. Related to the mongoDB website explanation they say, "There are no tables, no rows, no columns, no foreign keys. There are only objects."

I have a simple question, how are objects stored when using an Object Oriented database model and how does it store key techniques related to OO such as Polymorphism, Inheritance, ... if they are not stored as tables of some sort?

1 Answer 1


You touch here a key point of object-oriented databases. Most of these databases are not real object-oriented databases: they store data and not real objects with behaviors.

A typical example is MongoDB and similar document databases: they store sets of JSON objects, which are complex dynamic data structures with no access control and no behavior. Their main benefit in the OO context is an easier mapping to the native object model than with traditional ORM technologies. For performance reasons, MongoDB stores this data internally in a binary format called BSON. The core of the database is therefore a storage and indexing mechanism, that can store, find back and/or lock blocks of BSON data in an efficient manner.

In a data context, inheritance means to be able to store more or different fields for a specialised object. In a JSON context, the object being dynamic, it is not a problem for an object to store more or less or different data depending on whether it's a subtype or a supertype. In comparison, with ORM/RDBMS, you'd need to choose between several implementation strategies, some of them requiring to spread the data of one object accross multiple tables. Polymorphism is not handled here, in view of the absence of behavior.

In the 90s object databases were a booming research field, with the hope to store real objects with behaviors, and eventually also versioning the objects. Some experimental academic systems were built, but they never reached the maturity of the currently leading databases. One of the key problem was the storage of portable code, which made them language specific and not as suitable for multi-language multi-paradigm development as we know it today (not to speak about security risks that these features would mean in todays cyberrisky world).

  • So when it comes to a OODMS such as ZODB for Python, when I serialized an Object, how would this be represented, with tables? Also, are we saying that although MongoDB says OODB has no tables, in actuality they may, but their implementation did not?
    – Joe Smith
    Mar 9, 2022 at 2:20
  • This answer seems to confuse MongoDB (a document DB) with MongoDB Realm (claimed to be a OODB).
    – Rik D
    Mar 9, 2022 at 6:03
  • @JoeSmith I mentioned the tables only as comparison about how traditional databases store objects using ORM. Document databases or OODMS such as ZODB do not use tables. Instead they store behind teh scenes some "blocks" of data in a format that allows for some flexibility. What I call "block" here is contiguous data that stores everything you need to recover the object. The format of the block depend on the database. It can be a JSON for simplicity, it can be a a BSON for compactness and efficiency, or it can be any data resulting from serialization. No tables.
    – Christophe
    Mar 9, 2022 at 7:50
  • @JoeSmith I'm not a python expert, but ZODB seems to correspond to a real object database, since you cannot access/query data directly. But it is language specific. So you couldn't use it to store Python objects, and access/manipulate these objects from Java.
    – Christophe
    Mar 9, 2022 at 7:54
  • @RikD Thanks for pointing the possible confusion. I mentioned only MongoDB and the core of their product is document database. On the linked page there's a a link to the document DB atlas and a link to realm, with a narrative that suggests that document database is almost OOD. With realm, you may have an improved object orientation with an automatic mapping between database "objects" and classes. However, "objects" are still stored as data, and the possible use of GraphQL suggests that encapsulation/access control rules are not enforced, i.e. you could query some private properties
    – Christophe
    Mar 9, 2022 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.