Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
MongoDB 4 Quick Start Guide

You're reading from  MongoDB 4 Quick Start Guide

Product type Book
Published in Sep 2018
Publisher Packt
ISBN-13 9781789343533
Pages 192 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Doug Bierer Doug Bierer
Profile icon Doug Bierer

Installing MongoDB

For the purposes of this book, we focus on the MongoDB Community Edition for the simple reason that it's free of charge. This version is also an excellent way to get your feet wet, so to speak, allowing you to learn about and experiment with MongoDB risk free. Before beginning installation, be sure to check the minimum requirements for your operating system in the MongoDB installation manual: https://docs.mongodb.com/manual/installation/.

On a live server, in a commercial enterprise, it is recommended you use the MongoDB Enterprise Advanced version. You might also consider two cloud-based offerings, MongoDB Atlas or MongoDB Stitch. The former provides a cloud-hosted MongoDB database service. The latter builds upon the former, opening the MongoDB API so that your apps can make calls and receive responses.

Installing MongoDB on Windows

Download and install

To download and install MongoDB on Windows, proceed as follows:
  1. Go to the MongoDB download center at: https://www.mongodb.com/download-center#community.
  2. Select the appropriate operating system where it says Version.
  3. Click on DOWNLOAD (msi):
  1. When prompted, choose Save File.
  2. Click on the saved MSI file to start the installer.
  3. Click OK when the security prompt appears asking to Open Executable File?
  4. Click Run when the security warning appears.
  5. Click Next to start the MongoDB Setup Wizard.
  6. Read the license agreement and click on the checkbox and Next. Note that if you do not accept the license agreement the installation will terminate.
  7. When asked Choose Setup Type, for the purposes of this illustration, select Complete. MongoDB Compass, which is a handy utility which greatly facilitates database management, is automatically installed.
  8. Now that all choices have been made, click on Install and click Yes when the User Account Control security warning pops up.
  1. As of MongoDB v4.0, the installation wizard lets you configure startup options. If you want to have MongoDB start automatically and run in the background, choose Run service as Network Service user. You can also configure the directory where MongoDB stores its data files (Data Directory), and where log files are stored (Log Directory):
  1. Click Next to continue and Finish when the installation completes.

MongoDB Compass

Assuming you elected to install the complete package, MongoDB Compass will auto-launch once the installation completes. You will need to scroll down through its license agreement (separate from the license agreement for MongoDB itself), and click Agree. You can follow and then close the initial help tutorial, and also set Privacy Settings that control whether or not you will be sending crash reports, usage statistics, and requesting automatic updates to/from MongoDB Inc.

This utility is described in more detail in the Chapter 2, Understanding MongoDB Data Structures, We also use this utility to create our first database and collection (see following sections). Here is the Compass screen as seen on Windows:

MongoDB Windows file locations

If using the Windows MSI installer (recommended), the MongoDB program files will be stored here:

C:\Program Files\MongoDB\Server\<version>

You have the option, during the installation process, of specifying the location where the database and log files are stored. Once finished, here is a look at the new directory structure:

If you elected to install MongoDB as a service, it starts automatically, and can be administered just as any Windows service.

The configuration file, which contains the locations of the database and log files, defaults to:

C:\Program Files\MongoDB\Server\4.0\bin\mongod.cfg

This file is automatically generated by the installer. By default, here are its contents:

You have been reading a chapter from
MongoDB 4 Quick Start Guide
Published in: Sep 2018 Publisher: Packt ISBN-13: 9781789343533
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}