liveBook · Manning

Collection

As explained in Building Web APIs with ASP.NET Core

A document-database collection is a grouping of related documents that can contain records with flexible schemas.

A collection groups related documents in a document-oriented NoSQL database. Its documents use flexible key/value schemas rather than fixed rows and columns, so records can include related information directly. section 4.1.1

For the board-game API, a boardgames collection can store each game with its comments, while a users collection can hold user records and roles. Embedding parent-child data usually reduces the number of collections and avoids relying on references for every relationship. section 4.1.1

A collection differs from a table in several practical ways:

  • Uses flexible documents instead of a fixed schema of rows and columns. section 4.1.1
  • Stores related information inside a parent document when appropriate, producing a loosely structured and often denormalized design. section 4.1.1
  • Retains key-based relationships for entities, such as users, that multiple documents need to reference. section 4.1.1
Figure 4.2 MyBGList database schema diagram for a document-oriented NoSQL database
04-02

Use the document-oriented schema diagram to compare collections, embedded data, and relationships across the board-game API. section 4.1.1

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Defines collections through storage-model comparison and embedded relationships, without detailing database commands or implementation code.
Examples
Uses users, roles, board games, and comments to contrast embedded documents with separately referenced records.
What it assumes
Assumes familiarity with records and relationships while contrasting fixed SQL tables with flexible NoSQL documents.
What you can do after
Evaluate whether related records fit an embedded collection design or require key-based references across documents.
How it connects
Connects collections with documents, flexible schemas, denormalization, parent-child relationships, and key-based references.

Also explained in

Compare how 16 books explain collection →

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.