2025-04-14 12:02:19 +00:00

3.7 KiB

_layout
landing

Using Relational Databases as Document Stores

Bit Badger Solutions has developed, and continues to maintain, libraries that provide a document store interface over PostgreSQL and SQLite. If that sounds awesome, jump right in! If you want to explore the concept more fully, the second section has you covered. Either way, welcome!

Code

These libraries provide a convenient API to treat PostgreSQL or SQLite as document stores.

BitBadger.Documents ~ Documentation ~ Git
Use for .NET applications (C#, F#)

PDODocument ~ Documentation ~ Git
Use for PHP applications (8.2+)

solutions.bitbadger.documents ~ Documentation (soon) ~ Git (soon)
Use for JVM applications (Java, Kotlin, Groovy, Scala)

Concepts

When we use the term "documents" in the context of databases, we are referring to a database that stores its entries in a data format (usually a form of JavaScript Object Notation, or JSON). Unlike relational databases, document databases tend to have a relaxed schema; often, document collections or tables are the only definition required - and some even create those on-the-fly the first time one is accessed!

Note

This content was originally hosted on the Bit Badger Solutions main site; references to "the software that runs this site" is referencing myWebLog, an application which uses the .NET version of this library to store its data in a hybrid relational / document format.

A Brief History of Relational Data
Before we dig in on documents, we'll take a look at some relational database concepts

What Are Documents?
How documents can represent flexible data structures

Relational / Document Trade-Offs
Considering the practical pros and cons of different data storage paradigms

Application Trade-Offs
Options for applications utilizing relational or document data

Hybrid Data Stores
Combining document and relational data paradigms

Document Design Considerations
How to design documents based on intended use