Design with MongoDB

Best models for applications

To date, data has become a fundamental resource in all fields. Both large and medium-small companies analyze the data in their possession to plan all their activities, from marketing to production management. New professionals have emerged to address the challenges that data management and analysis pose. Among these, the data scientist has become one of the most sought after professionals.

Unfortunately, the exponential increase in the production of new data and the search for tools to extract useful information from them have relegated the figure of the database designer to the background. This figure, however, is fundamental to organize and store data in an appropriate way in order to speed up all the tools that use them. The design of a database, in fact, is a fundamental element in the construction of new technologies, new analysis tools and business development.

Design with MongoDB

The most used databases to date are relational databases, such as Mysql, PostgreSQL, Oracle, etc.. This technology, conceived and developed since the 60s of the last century, has been very successful and has evolved over the decades to the current solutions. The theoretical basis, however, has remained unchanged and is widely documented in various university books and not. The great limitation of relational databases is the need to define a database schema. This aspect has been overcome by NoSQL databases. The latter, in fact, are called schemaless, i.e. without schema.

Their strength is, however, also one of the most critical aspects of this new technology. Lacking a specific formalism and well-defined rules to model the database, the design becomes almost an art that is jealously guarded by specialists in the field.

Users of NoSQL databases always ask themselves the same question: How do I structure the data schema? Unfortunately, there is no single solution to the problem, but it is necessary to analyze the context, examples of data, if available, and use cases related to the applications that will rely on the database.

The book “Designing with MongoDB” will analyze some case studies to define the most used models in the design of NoSQL document databases, and in particular MongoDB, to improve database performance.

Where to buy it

The book is available on Amazon in the Italian version in both paperback, hardcover and e-book formats.

Amazon Italia

Italian version of the book is also available on Amazon in both paper and e-book format. The italian page describing the book is available here.

Amazon Italia

Amazon Francia

Amazon UK

Amazon Spagna

Contents

ACKNOWLEDGMENTS

FOREWORD

INTRODUCTION

Book structure

Who is this book for

Beyond the book

SECTION I PREREQUISITES

CHAPTER 1 A SHORT OVERVIEW OF MONGODB

1.1 MongoDB: a history

1.2 Data structure

1.3 Learning checks

SECTION II CASE STUDIES

CHAPTER 2 DESIGNING AN E-COMMERCE WEBSITE

2.1 Polymorphic model

2.1.1 Pros and cons of the polymorphic model

2.2 Attribute model

2.2.1 Pros and cons of the attribute model

2.3 Extended reference model

2.3.1 Pros and cons of the extended reference model

2.4 Tree model

2.4.1 Pros e cons of the tree model

2.5 Subset model

2.5.1 Pros and cons of the subsets model

2.6 Outlier model

2.6.1 Pros and cons of the outlier model

2.7 What we learned

2.8 Learning checks

CHAPTER 3 DESIGNING AN ENERGY CONSUMPTION MONITORING SYSTEM

3.1 Bucket model

3.1.1 Pros and cons of the bucket model

3.2 Pre-aggregated value model

3.2.1 Pros and cons of the pre-aggregated values model

3.3 Approximation model

3.3.1 Pros and cons of the approximation model

3.4 What we learned

3.5 Learning checks

CHAPTER 4 DESIGNING AN INFORMATION SYSTEM FOR A MEDICAL CENTER

4.1 Preallocation model

4.1.1 Pros and cons of the preallocation model

4.2 Document versioning model

4.2.1 Pros and cons of the document versioning model

4.3 Schema versioning model

4.3.1 Pros and cons of the schema versioning model

4.4 What we learned

4.5 Learning checks

SECTION III LEARNING CHECKS

CHAPTER 5 THEORY QUESTIONS

5.1 Polymorphism

5.2 Atomicity in MongoDB

5.3 NoSQL Features

5.4 Analysis in MongoDB

5.5 NoSQL for Social Networks

5.6 Storage engines in MongoDB

CHAPTER 6 EXERCISES ON MODELS

6.1 The product-supplier model

6.2 How to manage the bestsellers of an e-commerce website

6.3 Management of product characteristics

6.4 Best hotel reviews

6.5 Company organizational chart

6.6 Integration of different business services

6.7 Trace the logs of information systems

6.8 City registry

6.9 Optimizing a time series database

6.10 Website traffic monitoring

6.11 Measuring performance in IoT

6.12 Fast software release

6.13 Theatre Information System

6.14 Insurance policy management

CONCLUSIONS

BIBLIOGRAPHY

ABOUT THE AUTHOR

Additional material

MongoDB 5: the new features

MongoDB is the most widely used NoSQL database in the world. Its continuous growth is due to the continuous development of new features. Version 5, released at the end of July 2021, introduced some very interesting new features. In this article we will analyze the most relevant and most useful in their daily use.

Read more »
Schema MongoDB replica set con arbitro

Theory of MongoDB replica set

Replicata sets allow data to be redundant across different MongoDB instances, thereby increasing fault tolerance and availability to distribute workloads across different data centers. Let’s explore the main features.

Read more »