Book Image

MongoDB 4 Quick Start Guide

By : Doug Bierer
Book Image

MongoDB 4 Quick Start Guide

By: Doug Bierer

Overview of this book

MongoDB has grown to become the de facto NoSQL database with millions of users, from small start-ups to Fortune 500 companies. It can solve problems that are considered difficult, if not impossible, for aging RDBMS technologies. Written for version 4 of MongoDB, this book is the easiest way to get started with MongoDB. You will start by getting a MongoDB installation up and running in a safe and secure manner. You will learn how to perform mission-critical create, read, update, and delete operations, and set up database security. You will also learn about advanced features of MongoDB such as the aggregation pipeline, replication, and sharding. You will learn how to build a simple web application that uses MongoDB to respond to AJAX queries, and see how to make use of the MongoDB programming language driver for PHP. The examples incorporate new features available in MongoDB version 4 where appropriate.
Table of Contents (11 chapters)

What this book covers

Chapter 1, Introducing MongoDB, discusses NoSQL, provides an overview of MongoDB, and ends by covering detailed installation procedures for Windows as well as various forms of Linux servers. Also covered in this chapter, in addition to a discussion of the benefits of using MongoDB, are big picture questions including what is it and why use it.

Chapter 2, Understanding MongoDB Data Structures, covers foundational aspects of MongoDB database design, including documents, fields, and collections. Comparisons are drawn between SQL and MongoDB terminology. At the end of this chapter, you will learn how to create a MongoDB database.

Chapter 3, Using the Mongo Shell, of especial interest to DBAs, covers how to use the mongo shell to connect to a MongoDB database and perform CRUD (Create, Read, Update and Delete) operations. Plenty of JavaScript examples are provided.

Chapter 4, Developing with Program Language Drivers, goes through how to access a MongoDB database using PHP. Up until this point, examples are using JavaScript. In this chapter, the focus shifts to programming language driver access. This chapter will be of great interest to developers. Even if your main language is not PHP, the examples can be easily understood.

Chapter 5, Building Complex Queries Using Aggregation, addresses complex queries. The focus of this chapter will be on a feature unique to MongoDB called aggregation. This facility allows database developers or DBAs to return subsets of data grouped, sorted and filtered, running through a multi-stage pipeline. Plenty of JavaScript examples are provided.

Chapter 6, Maintaining MongoDB Performance, focuses on performance features such as indexing and sharded clusters. In addition, there is a substantial discussion on backup, restore, and replication. Solid working examples are shown, providing detailed steps that show you how to create a replica set as well as a sharded cluster.

Chapter 7, Securing MongoDB, shows how to secure the database itself, add users, and adjust permissions to specific collections. You will also learn how to enforce authentication and create an admin user. In addition, we address how to configure MongoDB to use SSL/TLS using x.509 certificates.

Chapter 8, Getting from Web Form to MongoDB, presents an end-to-end example using the PHP language driver. You will see how data posted from a web form is added to the database over a secure communications link, with security enabled. After that, you will see how a simple query is implemented showing the new entry. In addition, this chapter shows how to launch AJAX requests and have MongoDB respond using PHP.