You are previewing Data Modeling for MongoDB.
O'Reilly logo
Data Modeling for MongoDB

Book Description

Congratulations! You completed the MongoDB application within the given tight timeframe and there is a party to celebrate your application's release into production. Although people are congratulating you at the celebration, you are feeling some uneasiness inside. To complete the project on time required making a lot of assumptions about the data, such as what terms meant and how calculations are derived. In addition, the poor documentation about the application will be of limited use to the support team, and not investigating all of the inherent rules in the data may eventually lead to poorly-performing structures in the not-so-distant future. 

Now, what if you had a time machine and could go back and read this book. You would learn that even NoSQL databases like MongoDB require some level of data modeling. Data modeling is the process of learning about the data, and regardless of technology, this process must be performed for a successful application. You would learn the value of conceptual, logical, and physical data modeling and how each stage increases our knowledge of the data and reduces assumptions and poor design decisions. 

Read this book to learn how to do data modeling for MongoDB applications, and accomplish these five objectives:

  1. Understand how data modeling contributes to the process of learning about the data, and is, therefore, a required technique, even when the resulting database is not relational. That is, NoSQL does not mean NoDataModeling!
  2. Know how NoSQL databases differ from traditional relational databases, and where MongoDB fits.
  3. Explore each MongoDB object and comprehend how each compares to their data modeling and traditional relational database counterparts, and learn the basics of adding, querying, updating, and deleting data in MongoDB.
  4. Practice a streamlined, template-driven approach to performing conceptual, logical, and physical data modeling. Recognize that data modeling does not always have to lead to traditional data models!
  5. Distinguish top-down from bottom-up development approaches and complete a top-down case study which ties all of the modeling techniques together.

This book is written for anyone who is working with, or will be working with MongoDB, including business analysts, data modelers, database administrators, developers, project managers, and data scientists. There are three sections:

  • In Section I, Getting Started, we will reveal the power of data modeling and the tight connections to data models that exist when designing any type of database (Chapter 1), compare NoSQL with traditional relational databases and where MongoDB fits (Chapter 2), explore each MongoDB object and comprehend how each compares to their data modeling and traditional relational database counterparts (Chapter 3), and explain the basics of adding, querying, updating, and deleting data in MongoDB (Chapter 4).
  • In Section II, Levels of Granularity, we cover Conceptual Data Modeling (Chapter 5), Logical Data Modeling (Chapter 6), and Physical Data Modeling (Chapter 7). Notice the "ing" at the end of each of these chapters. We focus on the process of building each of these models, which is where we gain essential business knowledge.
  • In Section III, Case Study, we will explain both top down and bottom up development approaches and go through a top down case study where we start with business requirements and end with the MongoDB database. This case study will tie together all of the techniques in the previous seven chapters.

Key points are included at the end of each chapter as a way to reinforce concepts. In addition, this book is loaded with hands-on exercises, along with their answers provided in Appendix A. Appendix B contains all of the book’s references and Appendix C contains a glossary of the terms used throughout the text.

Table of Contents

  1. Foreword By Ryan Smith, Information Architect at Nike
  2. Introduction
    1. Conventions Used in This Book
  3. Section I Getting Started
  4. Chapter 1 The Power of Data Modeling
    1. Many Forms to Represent an Information Landscape
    2. Confirming and Documenting Different Perspectives
    3. Data Modeling Is Not Optional!
    4. Embarking on Our Publishing Adventure
    5. EXERCISE 1: Life Without Data Modeling?
  5. Chapter 2 The Power of NoSQL and MongoDB
    1. NoSQL vs. the Traditional Relational Database
    2. Four Types of NoSQL Databases
    3. MongoDB Is a Document-Oriented NoSQL Database
    4. Installing MongoDB
  6. Chapter 3 MongoDB Objects
    1. Entities
    2. Attributes
    3. Domains
    4. Relationships
    5. Keys
  7. Chapter 4 MongoDB Functionality
    1. Adding Data in MongoDB
    2. Querying Data in MongoDB
    3. Updating Data in MongoDB
    4. Deleting Data in MongoDB
    5. EXERCISE 4: MongoDB Functionality
  8. Section II Levels of Granularity
  9. Chapter 5 Conceptual Data Modeling
    1. Concept Explanation
    2. Conceptual Data Modeling Approach
    3. EXERCISE 5: Conceptual Data Modeling Mindset
  10. Chapter 6 Logical Data Modeling
    1. Logical Data Modeling Approach  
    2. EXERCISE 6: Logical Data Modeling Mindset
  11. Chapter 7 Physical Data Modeling
    1. Physical Data Modeling Approach
  12. Section III Case Study
  13. Chapter 8 Survey Data Entry
    1. Case Study Background
    2. Conceptual Data Modeling
    3. Logical Data Modeling
    4. Physical Data Modeling
  14. APPENDIX A Answers to Exercises
    1. EXERCISE 1: Life without Data Modeling?
    2. EXERCISE 2: Subtyping in MongoDB
    3. EXERCISE 3: Interpreting Queries
    4. EXERCISE 4: MongoDB Functionality
    5. EXERCISE 5: Conceptual Data Modeling Mindset
    6. EXERCISE 6: Logical Data Modeling Mindset
    7. EXERCISE 7: Embed or Reference
  15. APPENDIX B References
  16. APPENDIX C Glossary
  17. Index