MongoDB #1 Installation

Tim Haag
2 min readAug 7, 2017

--

If you’re new to MongoDB this guide helps you to take the first steps within the NoSQL/RDBMS world.

To get started you have to download MongoDB for your OS. Use the following official link for that:

Depending on your OS you might have to set an environment variable to get global access to the MongoDB CLI tools.

At first create a directory for your MongoDB. This directory is used by MongoDB to story your data. Preferable use an empty directory otherwise it could get really messy with all the data within the directory.

Start your first MongoDB instance using the following command from within your console:

mongod --dbpath your/mongodb/directory

Keep the console open until you want to shut down your MongoDB instance. To shut down your MongoDB use

CTRL + C

on OS X or

STRG + C

on Windows.

MongoDB will use 27017 as default port. If you want to change the port expand your start up command to the following:

mongod --dbpath your/mongodb/directory --port 1234

Your first MongoDB instance is now running and waits for incoming connections. To connect to your MongoDB just use the following command within a new console:

mongo

Now you should see something like:

Tims-MBP:~ timhaag$ mongoMongoDB shell version: 3.2.10connecting to: testServer has startup warnings:2017-08-07T14:48:50.384+0200 I CONTROL  [initandlisten]2017-08-07T14:48:50.384+0200 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000>

If thats the case you’ve successfully started you first MongoDB instance.

That’s it for #1. Stay tuned! The next topic is about database creation and deletion.

--

--

Tim Haag
Tim Haag

Written by Tim Haag

Software, Cloud and Digitalization

No responses yet