LearnInstalling MongoDB on Windows

Avatar

Dev Support
writes on October 14, 2022

What’s MongoDB?

MongoDB is a document database which belongs to a family of databases called NoSQL – not only SQL. In MongoDB, records are documents which behave a lot like JSON objects in JavaScript. Values in documents can be looked up by their field’s key. Documents can have some fields/keys and not others, which makes Mongo extremely flexible.

This is different than SQL databases like MySQL and PostgreSQL, where fields correspond to columns in a table and individual records correspond to rows.

Prerequisites

You should have a general familiarity with the Windows command prompt.

Installing and Running MongoDB on a Windows Machine

  • Download the MongoDB installer file from the downloads section of the MongoDB website.
  • Find the dowloaded .msi file in the Windows Explorer. Double click the file and follow the prompts to install Mongo. Note: unless you specify a custom directory Mongo is most likely installed in the C:\mongodb directory**. However, based on settings on your machine Mongo may be installed other places. For example, C:\Program Files\MongoDB\Server\3.2. Additionally, you may find MongoDB in the add/remove programs menu.
  • Create the directory where MongoDB will store it’s files. From the command prompt run md \data\db. This is the default location. However, other locations can be specified using the --dbpath parameter. See the Mongo docs for more information.
  • Start the mongodb daemon by running C:\mongodb\bin\mongod.exe in the Command Prompt. Or by running, C:\path\to\mongodb\bin\mongod.exe
  • Connect to MongoDB using the Mongo shell While the MongoDB daemon is running, from a different Command prompt window run C:\mongodb\bin\mongo.exe

GET STARTED NOW

Learning with Treehouse for only 30 minutes a day can teach you the skills needed to land the job that you've been dreaming about.

Get Started

Leave a Reply

You must be logged in to post a comment.

man working on his laptop

Are you ready to start learning?

Learning with Treehouse for only 30 minutes a day can teach you the skills needed to land the job that you've been dreaming about.

Start a Free Trial
woman working on her laptop