Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
MongoDB 4 Quick Start Guide
MongoDB 4 Quick Start Guide

MongoDB 4 Quick Start Guide: Learn the skills you need to work with the world's most popular NoSQL database

eBook
$9.99 $25.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

MongoDB 4 Quick Start Guide

Understanding MongoDB Data Structures

In this chapter, we will begin with a discussion of NoSQL, which is a cornerstone of the MongoDB philosophy. After that, we will cover the core MongoDB data structures: fields, documents, and collections. We relate these structures to the RDBMS concepts of tables, rows, and columns, but clearly spell out the dangers of trying to apply an SQL solution to a MongoDB database. In addition, we discuss core data-modeling considerations when crafting the structure of your documents and collections. Finally, the chapter ends by showing you how to create a database and collection.

The topics that we will cover in this chapter are:

  • What is NoSQL?
  • Documents, collections, and databases
  • Data-modeling considerations
  • Creating a MongoDB database and collection

What is NoSQL?

Before you can begin to use MongoDB properly, it's important to understand its architectural underpinnings. Key to this understanding is what is often referred to as NoSQL. As the rubric implies, a NoSQL database does not use SQL language. More importantly, this means that a NoSQL database is free from the legacy, two-dimensional restrictions that handcuff the traditional RDBMS.

There is no formal definition of NoSQL, but there are certain common characteristics. First of all, a NoSQL database does not adhere to the relational model. This is evident in that MongoDB has no fixed schema, no tables, columns, or rows. A second consideration is that NoSQL databases are driven by the needs of big data. Accordingly, NoSQL databases tend to be scalable as well as distributed. This aspect is visible in the MongoDB feature called sharding, where shards of the database...

Documents, collections, and database

In order fully to understand how to use MongoDB, it is important to discuss the terms used to describe MongoDB data structures: documents, fields, and collections. The following table summarizes these three terms by way of illustration. In this table, we also draw an equivalence between MongoDB and RDBMS (Relational Database Management Systems):

MongoDB
RDBMS
Illustration
Document Row
Field Column
Collection Table

In the preceding example, we see a document that represents information about a member whose name is Smith. Within the document are fields, the example highlighted being cost. Documents that are stored together for a single logical purpose represent a collection. A MongoDB database consists of one or more collections.

The astute reader will no doubt notice the lack of the MongoDB equivalent to a traditional...

Data-modeling considerations

So far, if you are used to traditional SQL-based database systems, you will no doubt be pleased to learn there are direct equivalences between basic data structures, such as fields, documents, and so forth. When it comes to data modeling, on the other hand, a radical departure in thought is needed. We will begin this discussion by comparing a MongoDB reference with an embedded document.

References

Creating a MongoDB database and collection

It is now time to put into practice how to create a MongoDB database and collection. The Chapter 3, Using the MongoDB Shell, will show you how to perform operations using the MongoDB shell. For the purposes of this introductory chapter we will use MongoDB Compass (https://www.mongodb.com/products/compass), which is a free graphical utility you can use to perform administration.

To create a MongoDB database and start a collection using MongoDB Compass, proceed as follows:

  1. Open MongoDB Compass using the link as appropriate to your operating system. In this illustration we are using Ubuntu Linux, so we launch using the GUI.
  2. Click on the plus sign (+) to create a database:
  3. When the Create Database dialog box appears, enter the name of the database and the name of the first collection. When first creating a database, you cannot have one...

Summary

In this chapter, you learned:

  • The architectural underpinnings of NoSQL databases and MongoDB, in particular
  • MongoDB terms, including databases, collections, documents, and fields
  • Data-modeling considerations, document design, and how to avoid SQL-based thinking
  • How to create a MongoDB database and start a collection using MongoDB Compass

The next chapter will cover how to use the MongoDB shell to manage the database, including basic CRUD operations.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Create secure databases with MongoDB
  • Manipulate and maintain your database
  • Model and use data in a No SQL environment with MongoDB

Description

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.

Who is this book for?

Web developers, IT professionals and Database Administrators (DBAs) who want to learn how to create and manage MongoDB databases.

What you will learn

  • Get a standard MongoDB database up and running quickly
  • Perform simple CRUD operations on the database using the MongoDB command shell
  • Set up a simple aggregation pipeline to return subsets of data grouped, sorted, and filtered
  • Safeguard your data via replication and handle massive amounts of data via sharding
  • Publish data from a web form to the database using a program language driver
  • Explore the basic CRUD operations performed using the PHP MongoDB driver

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Sep 28, 2018
Length: 192 pages
Edition : 1st
Language : English
ISBN-13 : 9781789349726
Category :
Languages :
Concepts :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Sep 28, 2018
Length: 192 pages
Edition : 1st
Language : English
ISBN-13 : 9781789349726
Category :
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 126.97
Mastering Docker
$54.99
MongoDB 4 Quick Start Guide
$32.99
Mastering MongoDB 4.x
$38.99
Total $ 126.97 Stars icon
Banner background image

Table of Contents

10 Chapters
Introducing MongoDB Chevron down icon Chevron up icon
Understanding MongoDB Data Structures Chevron down icon Chevron up icon
Using the MongoDB Shell Chevron down icon Chevron up icon
Developing with Program Language Drivers Chevron down icon Chevron up icon
Building Complex Queries Using Aggregation Chevron down icon Chevron up icon
Maintaining MongoDB Performance Chevron down icon Chevron up icon
Securing MongoDB Chevron down icon Chevron up icon
Getting from a Web Form to MongoDB Chevron down icon Chevron up icon
Using Docker Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Amazon Customer Nov 27, 2019
Full star icon Full star icon Full star icon Full star icon Full star icon 5
good topics explanation, many topics links linked to concepts into the book enforced. access to code examples. easy to read
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.