What is a document-relational database?

A document-relational database combines the flexibility and familiarity of JSON documents with the relationships and querying power of a traditional relational database.

Much of today’s software involves reading JavaScript Object Notation (JSON) documents in one format, performing an action, and storing the result as a separate JSON document with a new shape. For example, an e-commerce website might accept a document representing a shopping cart full of items, process a payment, and store a new object with information about an order.

Why developers like document databases

Document databases allow developers to store domain objects such as shopping carts, items, payments, and orders in the same format that they use in their applications. This simplifies the storage and retrieval of these objects, especially for well-defined access patterns such as retrieving a document by its ID. Document databases also allow flexibility in the shape of documents. For example, consider an inventory database in which every item must have a price, but some items have custom fields which are not present for every item. Document databases can handle flexible data schemas which reflect the shape of the underlying data, rather than enforcing a one-size-fits-all approach to data modeling.

Why developers like relational databases

Document databases are less useful for expressing the relationships between documents. Relational databases perform better at joining related data, such as showing all orders for a particular customer or all items over a certain price. Developers must trade flexibility in their data model to achieve these performance gains, specifying every field of each object as a column and each object as a single row in a given table. Related entities can be expressed as links to rows in other object tables via foreign keys.

Why developers love Fauna

Fauna is a document-relational database that combines the flexibility and familiarity of JSON documents with the relationships and querying power of a traditional relational database. Fauna accelerates modern application development by integrating semi-structured document data with ACID guarantees and a robust query language, the Fauna Query Language (FQL). Fauna also provides foreign keys, views, and joins, so that you can structure your data the way you think about it without complicated workarounds like single-table design.

Fauna is distributed data, simplified. Fauna offers features that other document and relational databases cannot, such as strongly consistent, distributed, and performant transactions that simplify your application logic. A serverless operational model frees you from operational tasks and allows you to focus on shipping features that add customer value.

As the first document-relational database, Fauna frees you from the limitations of other data platforms to create more value, faster.

Was this article helpful? 

We're sorry to hear that.
Tell us how we can improve!
Visit Fauna's forums or email docs@fauna.com

Thank you for your feedback!