What is the difference between object-oriented and document databases?
Asked Answered
C

1

9

What is the difference between object-oriented and document databases?

I didn't use object-oriented databases, but when I use document database (RavenDb) I store and read usual object-oriented classes without problems.

Crucifer answered 27/3, 2012 at 6:30 Comment(0)
B
10

I went from db4o (OODB) to RavenDB (document DB). The big difference, that I found, is that object DBs store the full objects, and when an object gets stored with another object within it, that sub-object is stored in full and it's the latest version of that object. With a document DB, objects are still stored, but they're organized differently. An aggregate/root object will store parts of a sub-object so that the aggregate/root object is self-contained. When you retrieve the root object, you're not reaching out and grabbing objects that are related to it.

An OODB would store a Team this way:

TeamName
City
List<Player>  // The entire player objects would be stored here

A document DB would store a team this way:

TeamName
City
List<string> PlayerNames

PlayerNames would be stored here, because that's all the team object needs.

RavenDB has a good explanation of the theory of document DBs here:

http://ravendb.net/docs/theory/document-structure-design

Benelux answered 27/3, 2012 at 13:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.