3 ms·
Why do people say document database when they really just mean json database?
by WhitneyLand 1mo ago
Why do people say document database when they really just mean json database?
- petcat 1mo agoJSON is just a textual representation of the internal data structures.
- quietbritishjim 1mo agoThat is still not what I'd call a "document".
- QuantumNomad_ 1mo agoThe 1st edition CouchDB book from 2010 explained it like this: > We write software to improve our lives and the lives of others. Usually this involves taking some mundane information—such as contacts, invoices, or receipts—and manipulating it using a computer application. CouchDB is a great fit for common applications like this because it embraces the natural idea of evolving, self-contained documents as the very core of its data model. > Self-Contained Data > An invoice contains all the pertinent information about a single transaction—the seller, the buyer, the date, and a list of the items or services sold. As shown in Figure 1, “Self-contained documents”, there’s no abstract reference on this piece of paper that points to some other piece of paper with the seller’s name and address. Accountants appreciate the simplicity of having everything in one place. And given the choice, programmers appreciate that, too. > Yet using references is exactly how we model our data in a relational database! Each invoice is stored in a table as a row that refers to other rows in other tables—one row for seller information, one for the buyer, one row for each item billed, and more rows still to describe the item details, manufacturer details, and so on and so forth. https://guide.couchdb.org/editions/1/en/why.html https://guide.couchdb.org/editions/1/en/why.html Iow, a document database stands in contrast to a relational db in that these JSON things we store in them are more stand-alone “documents” compared to storing data in rows and columns in a relational db like PostgreSQL or SQLite.
- SOLAR_FIELDS 1mo agoThe thing that people always miss about this takeaway is that while it is a truism, most data is actually inherently relational. Even in your example given, the individual components that are made to assemble that document are better represented as relational datastores
- jmalicki 1mo agoNothing here says the data isn't relational. It strongly disagrees, with reasons, why it's not better represented as relational. Personally I prefer the relational stance, and there are a lot of people who don't get it who say things like "this data isn't relational", but that's not the argument GP made.
- bitwize 1mo agoIn the real world of business, generally you want to store these pieces of information together to establish a historical record, not have references or links to other tables, etc. Links and relations are fragile, as anyone who's clicked through to a 404 can attest. Standalone documents last as long as the media that stores them.
- sgarland 1mo agoImmutable records which are retained for legal purposes should be in object storage, not a database.
- somat 1mo agoI would argue most data is inherently(naively?) hierarchical(the document), relational structured data is a clever but unintuitive mechanism to introduce powerful analytic opportunities to a set of data. Basically a document is a report, a large disjoint volume of information on a subject, I consider this the natural form of data because this is how it is collected and how most people think about it. relational is sort of like storing that data as vertical slices through your stack of reports. Not natural at all but much nicer for analysis across the data set.
- 1mo ago
- Calavar 1mo agoIt's a MongoDBism. The MongoDB community used document to mean the nonrelational equivalent of a row in a relational database. But over time there was definitional shift, and now it means a JSON blob, even if that blob is in a relational database.
- flomo 1mo agoIt's a much older term, eg. Lotus Notes was described as a document database.
- somat 1mo agoThe "document" is sort of the native data type, Put everything in a big hierarchical structure, It is very flexible but analytics across the set can suffer. "relational" is another way to store data, break your big hierarchy into sets of related rows and store the rows as a table, If I were to describe it in geometric terms where the document is a report on a paper, the relation is a vertical slice through a stack of those reports. This is slightly non-intuitive but provides for interesting analysis opportunities. But nothing prevents you from treating your relational database as a document database, set it up as a key-value store where each key is is the document title and each value is a large blob of document data. If your documents are fairly consistent it is also easy enough to build indexes and query features to regain some of the analytical ability of relational data.
- bitwize 1mo ago1) The internal or wire representation of data from document DBs isn't necessarily JSON, though it's normally converted to such. 2) "Document" has undergone a bit of semantic drift thanks to HTML and XML. In an informational context it means "structured, hierarchical unit of data containing mostly text". The data from forms, invoices, and the like needs to be collected and stored, even if it isn't properly normalized and relationalized (or is en route to being such) so a "document database" is thought to be suited to this task I dunno, whatever, I'm in the "just fucking use postgres until you can justify why you shouldn't" camp.
- da_chicken 1mo agoI think it originates with the early web. JSON being a replacement for XML, and "document" being the general description for the response to a web server.