liveBook · Manning

Schema flexibility

As explained in Building Web APIs with ASP.NET Core

A flexible schema is a database structure that allows documents or records in the same collection to have different fields or shapes.

Schema flexibility lets documents in the same collection use different key/value fields and shapes. This contrasts with SQL tables, where rows and columns follow a fixed schema. section 4.1.1

A flexible document schema changes how related data is organized:

  • A board-game document can contain the board game and related comments together, reducing the need for separate collections. section 4.1.1
  • Parent-child relationships are commonly embedded, while key-based relationships remain useful for entities referenced by multiple documents, such as users. section 4.1.1
  • The resulting structure is loosely organized and denormalized rather than a highly normalized set of fixed tables. section 4.1.1

Board-game data

A document-oriented board-game database can store board-game details and their comments in one document, while user documents can retain roles and remain referenced from other documents. section 4.1.1

Figure 4.2 MyBGList database schema diagram for a document-oriented NoSQL database
04-02

Compare the document-oriented schema diagram with the table-oriented alternative to see how flexible documents change collections and relationships. section 4.1.1

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Defines flexible documents and embedded relationships, but stops short of product-specific implementation details.
Examples
Uses users, roles, board games, and comments to compare embedded document data with separate relational tables.
What it assumes
Teaches fixed-schema tables as the comparison point before introducing flexible document collections.
What you can do after
Evaluate how a document database can organize related records with fewer collections and less reliance on keys.
How it connects
Connects schema flexibility with NoSQL databases, document storage, embedded relationships, denormalization, and fixed-schema SQL tables.

Also explained in

Compare how 3 books explain schema flexibility →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.