MongoDb shuts down with Code 100 [closed]

I followed the MongoDb Docs to setup my first MongoDb,

When I start MongoDB using the command

C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe

I get the following error enter image description here


MongoDB needs a folder to store the database. Create a C:\data\db\ directory:

mkdir C:\data\db

and then start MongoDB:

C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe

Sometimes C:\data\db folder already exists due to previous installation. So if for this reason mongod.exe does not work, you may delete all the contents from C:\data\db folder and execute mongod.exeagain.


For macOS users to fix this issue:

You need to go through the following steps:

Create the “db” directory. This is where the Mongo data files will live. You can create the directory in the default location by running:

sudo mkdir -p /data/db

Make sure that the /data/db directory has the right permissions by running:

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

You're all set now and you can run sudo mongod to start the Mongo server.

It's not working if you run only mongod

Source.


Same issue on my Mac (using Brew) solved using:

sudo mongod