0
votes

2018-10-08T15:49:48.157+0530 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'

2018-10-08T15:49:48.175+0530 I CONTROL [initandlisten] MongoDB starting : pid=65956 port=27017 dbpath=/data/db 64-bit host=Mayurs-MacBook-Air.local

2018-10-08T15:49:48.175+0530 I CONTROL [initandlisten] db version v4.0.2

2018-10-08T15:49:48.175+0530 I CONTROL [initandlisten] git version: fc1573ba18aee42f97a3bb13b67af7d837826b47

2018-10-08T15:49:48.175+0530 I CONTROL [initandlisten] allocator: system

2018-10-08T15:49:48.175+0530 I CONTROL [initandlisten] modules: none

2018-10-08T15:49:48.175+0530 I CONTROL [initandlisten] build environment:

2018-10-08T15:49:48.175+0530 I CONTROL [initandlisten] distarch: x86_64

2018-10-08T15:49:48.175+0530 I CONTROL [initandlisten] target_arch: x86_64

2018-10-08T15:49:48.175+0530 I CONTROL [initandlisten] options: {}

2018-10-08T15:49:48.175+0530 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating

2018-10-08T15:49:48.176+0530 I CONTROL [initandlisten] now exiting

2018-10-08T15:49:48.176+0530 I CONTROL [initandlisten] shutting down with code:100

How can solve this?

1
Please make a folder named "data" and inside it make another folder named "db" in c drive. then run the command. as it is finding the "Data directory"DevProf

1 Answers

0
votes

In the default configuration, mongodb uses /data/db directory for storing its database files.

2018-10-08T15:49:48.175+0530 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating

This shows that the directory does not exist, so you have to create it.

Try:

sudo mkdir /data
sudo mkdir /data/db
sudo mkdir /data/logs

I'm not sure if the last command will be needed, but just fire it to be safe.

An alternative to this would be to find the mongo config file (I don't know where it is on macOs) and then change the /data/db path inside it to your desired location that exists.