Download & Install MongoDB with Compass on Windows

Alpesh Patel
Nerd For Tech
Published in
5 min readJun 18, 2022

MongoDB is an open-source document database and leading NoSQL database. MongoDB is written in C++. This tutorial will give you great understanding on MongoDB concepts needed to create and deploy a highly scalable and performance-oriented database.

Before proceeding with this tutorial, you should have a basic understanding of database, text editor and execution of programs, etc. Because we are going to develop high performance database, so it will be good if you have an understanding on the basic concepts of Database (RDBMS).

Let us now see how to Download & install MongoDB on Windows:

MongoDB Download

MongoDB Community server is free to use for development, so let’s search in google:

Make sure that the specifications to the right of the screen are correct. At the time of writing, the latest version is 5.0.9. Ensure that the platform is Windows, and the package is MSI. Go ahead and click on the download.

MongoDB Installation

You can find the downloaded file in the downloads directory. You can follow the steps mentioned there and install the software.

Accept the license agreement, then click Next.

Select the Complete setup.

Select “Run service as Network Service user” and make a note of the data directory, we’ll need this later.

Let’s install with Mongo Compass, so select it and click Next.

Click Install to begin installation.

On completing the installation successfully, you can see WelCome scree of MongoDB Compass:

General Connection Tab

The General connection tab allows you to select a Connection String Scheme and configure the hostname or hosts used to connect to your MongoDB deployment.

Compass Home

The Compass Home screen provides details regarding the MongoDB instance to which Compass is connected, including:

  • The connection name if the connection is a favorite connection, or “My Cluster” otherwise.
  • The deployment type (standalone, replica set, sharded cluster). If the deployment is a replica set and the replica set name is specified in the connection window, the number of replica set members will also be displayed.
  • The hostname and port, as well as the version of MongoDB.

Databases Tab

The Databases tab of the Home screen shows a list of all the databases on the current connection, with each one’s storage size, number of collections, and number of indexes. For more information about the Databases tab and instructions on viewing a database
Now let’s create the first database in MongoDB to click on Create database button:

From the Database tab, click the Create Database button to bring up the Create Database dialog.
In the dialog, enter the name of the database to create and its first collection. Both the database name and the collection name are required.

On completing the database, create success, you can see your database in

Collections

A collection is a grouping of MongoDB documents. Documents within a collection can have different fields. A collection is the equivalent of a table in a relational database system.

Here, We are already created one collection with created database so you can see your collection is created:

Manage Documents

Documents are individual records in a MongoDB collection and are the basic unit of data in MongoDB.

From the Documents tab, you can view, insert, modify, clone, and delete documents in your selected collection or view.

Insert Documents

Compass provides two ways to insert documents into your collections: JSON Mode and a Field-by-Field Editor.

JSON Mode (New in Compass 1.20) Allows you to write or paste JSON documents in the editor. Use this mode to insert multiple documents at once as an array.Field-by-Field EditorProvides a more interactive experience to create documents, allowing you to select individual field values and types. This mode only supports inserting one document at a time.

To insert documents into your collection:

Click the Add Data dropdown and select Insert Document.

Select the appropriate view based on how you would like to insert documents.

  • Click the { } brackets for JSON view. This is the default view.
  • Click the list icon for Field-by-Field mode.

In JSON format, type or paste the document(s) you want to insert into the collection. To insert multiple documents, enter a comma-separated array of JSON documents and Click Insert.

Congratulation..! Here your first Database successfully created in MongoDB.

--

--

Alpesh Patel
Nerd For Tech

Technology Specialist and Full-Stack Developer. Find me on linkedin for more details https://www.linkedin.com/in/alpesh-patel-8b930952