How to Fix Shutting Down With Code:100 Error in MongoDB

Tahseen Tauseef Feb 02, 2024
  1. the shutting down with code:100 Error in MongoDB
  2. Fix the shutting down with code:100 Error in MongoDB
  3. Conclusion
How to Fix Shutting Down With Code:100 Error in MongoDB

This MongoDB tutorial will teach you to fix the shutting down with code:100 error on different operating systems. This will also talk about the root causes of why this issue occurs.

the shutting down with code:100 Error in MongoDB

MongoDB, as you all know, is well-known for its schema-free database. It does not use the table and column concepts used in SQL.

Instead, the concept of documents and collections is used. That is why MongoDB is so widely used.

However, it is not uncommon to encounter issues when launching the MongoDB server.

Fortunately, when MongoDB exits, it returns codes and statuses for you. These codes also aid in the debugging of MongoDB errors.

But why is it exiting with code 100? When a process throws an uncaught exception, the MongoDB system returns the exit code 100.

There are two main reasons for the MongoDB code 100 error, and we will discuss them in the following sections.

the MongoDB shutting down with code:100 Error Due to Incorrect File Permissions

One main reason for this error is incorrect file permissions.

While starting MongoDB, you can get an error like shutting down with code:100. This error looks like the error shown in the image below:

MongoDB Error - Incorrect File Permissions

This problem occurred due to either a permission issue with the data files or the inability to find the desired file location.

the MongoDB shutting down with code:100 Error Due to Missing Database Directory

Sometimes, servers often show this MongoDB error due to a missing database directory. For example, you can get the following error when starting the Mongo service.

MongoDB Error - Missing Database Directory

Usually, the database directory contains all the MongoDB files. Therefore, missing database directories will cause this particular MongoDB error.

Fix the shutting down with code:100 Error in MongoDB

Now, we will explore how to fix these errors in different operating systems such as Windows OS, macOS, and Ubuntu.

Fix the MongoDB shutting down with code:100 Error in Windows

Previously, you learned the main reasons for the exit with code 100.

You can create a /data/db directory using the command below:

mkdir C:\data\db

Then, you can try to start MongoDB again, and it should work fine.

Sometimes the folder already exists in the system due to the previous installation.

So if this is the reason for getting the error, you need to delete all the content from the folder and then start the MongoDB server. This will resolve the problem.

Fix the MongoDB shutting down with code:100 Error in macOS

For macOS users, you can try to resolve this issue using the following steps.

First, you will need to create the db directory because Mongo data files need to be stored in this directory.

Then you can create the directory in macOS using the command line below.

sudo mkdir -p /data/db

You also have to provide the correct permissions to the directory using the command line below.

sudo chown -R 'id -un' /data/db

Now, with the help of the sudo mongod command, you can successfully start the Mongo server. Note that it will not work if you only use mongod.

Fix the MongoDB shutting down with code:100 Error in Ubuntu

For Ubuntu users, this error shutting down with code 100 occurs mainly due to a permission issue with the data files, so to resolve this error, you need to change the ownership to the MongoDB user.

sudo chown -R mongodb:mongodb /var/lib/mongodb

Running the command above will change the ownership to the MongoDB user and resolve the existing MongoDB error. Now, you can successfully run the MongoDB server.

Conclusion

The MongoDB exit code 100 error occurs due to the incorrect file permissions and missing database directories. This article discussed how you could fix this MongoDB error for yourself.