DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Data Engineering
  3. Databases
  4. Getting Started With MongoDB

Getting Started With MongoDB

In this article, we will learn how to set up and start with MongoDB in Windows Operating System.

Anoop Kumar Sharma user avatar by
Anoop Kumar Sharma
CORE ·
Oct. 11, 18 · Tutorial
Like (3)
Save
Tweet
Share
5.63K Views

Join the DZone community and get the full member experience.

Join For Free

In this article, we will look at a MongoDB tutorial that explains how to set up and start with MongoDB in Windows Operating System.

MongoDB

MongoDB is a free, open-source, cross-platform, document-oriented, not a relational one, Schema-less, easy to use and scale out, powerful, NoSQL database. It stores the data in the form of JSON, not in tables. It replaces the concept of the row with the document, which provides the flexible model. (We will learn about the collection, documents, etc. in an upcoming article of this series).

Let’s Begin

Go to MongoDB Official Website in order to download the MongoDB Package (https://www.mongodb.com/download-center#atlas), click on the community server.
Select the Operating System for which you want to download the MongoDB. Click on Download (MSI installer file).

Note: In case you don’t know the Version and architecture of your windows operating system, then follow the below-mentioned steps.
You can find the Version and Architecture of Operating System in two ways:
1. Go to “This PC”, and the right click on the windows explorer, click on Properties.

System Architecture2. Open “Command prompt”, then type the below command in order to find the architecture of the operating system:
wmic OS get OSArchitecture

Use this command “wmic OS get caption” in command prompt in order to find the version of the Windows OS Installed in the system.

Now, Install the Downloaded MSI file. Double click on the MSI, and click on next.

Accept the end-user license agreement and click on next.

Choose setup type, select complete. (You can choose custom if don’t want to install complete package or wants to change the default installation location).

Select checkbox in case if you want to install MongoD (MongoD is the primary daemon process for the MongoDB system) as a service. We can even install MongoD as the service later as well (We will learn How to Configure MongoD as a service in the next Article).

In the next step, the installer will ask to Install MongoDB Compass. Basically, it provides a GUI for MongoDB so that users can explore the data visually.

Click install button in order to Install MongoDB.

Click on Finish if setup installed successfully.

Before running the MongoD Command, lets set the Path Variable first. Go to “This PC”, right click on windows explorer, and click on properties.


Click on Advanced system settings.

Click on Environment Variables button under the Advanced tab in System properties dialog.

Select Path Variable and Click on Edit Button.

Add new path variable and copy and paste the bin path location of the MongoD files installed. In my system, MongoDB is installed in “C:\Program Files\MongoDB\”. Go to that Directory and open Server folder, then 4.0 folder and then bin folder and copy the path from the explorer “C:\Program Files\MongoDB\Server\4.0\bin”.

In order to run the MongoDB server, we need to configure the data directory where all the database will be stored.  I have created a folder (named it as MongoFiles. You can give any name to that folder) in C drive with “data/db” as Sub Directory. In my case, the complete path will be “C:\MongoFiles\data\db”.

Note: In case you didn’t already create the data\db directory, Mongo will look in the data\db folder in C: Drive, you will get an error like below:
NonExistentPath: Data directory C:\data\db\ not found., terminating

Once MongoD command runs successfully, open another command prompt and run Mongo command. It will connect you to mongo shell on your localhost with default port 27017.

Use db command in order to check your current selected database.

Hope this will help you.
Thanks!

MongoDB operating system

Published at DZone with permission of Anoop Kumar Sharma, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Top 10 Secure Coding Practices Every Developer Should Know
  • Beginners’ Guide to Run a Linux Server Securely
  • Easy Smart Contract Debugging With Truffle’s Console.log
  • Promises, Thenables, and Lazy-Evaluation: What, Why, How

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: