0

My MongoDB server was running fine until yesterday. But then I encountered this error:

2020-03-31T10:21:25.981+0530 I  CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'
2020-03-31T10:21:25.986+0530 I  CONTROL  [initandlisten] MongoDB starting : pid=7544 port=27017 dbpath=C:\data\db\ 64-bit host=DESKTOP-IP084D8
2020-03-31T10:21:25.987+0530 I  CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2020-03-31T10:21:25.987+0530 I  CONTROL  [initandlisten] db version v4.2.3
2020-03-31T10:21:25.987+0530 I  CONTROL  [initandlisten] git version: 6874650b362138df74be53d366bbefc321ea32d4
2020-03-31T10:21:25.987+0530 I  CONTROL  [initandlisten] allocator: tcmalloc
2020-03-31T10:21:25.987+0530 I  CONTROL  [initandlisten] modules: none
2020-03-31T10:21:25.987+0530 I  CONTROL  [initandlisten] build environment:
2020-03-31T10:21:25.987+0530 I  CONTROL  [initandlisten]     distmod: 2012plus
2020-03-31T10:21:25.987+0530 I  CONTROL  [initandlisten]     distarch: x86_64
2020-03-31T10:21:25.987+0530 I  CONTROL  [initandlisten]     target_arch: x86_64
2020-03-31T10:21:25.988+0530 I  CONTROL  [initandlisten] options: {}
2020-03-31T10:21:25.990+0530 I  STORAGE  [initandlisten] exception in initAndListen: NonExistentPath: Data directory C:\data\db\ not found., terminating
2020-03-31T10:21:25.990+0530 I  NETWORK  [initandlisten] shutdown: going to close listening sockets...
2020-03-31T10:21:25.990+0530 I  -        [initandlisten] Stopping further Flow Control ticket acquisitions.
2020-03-31T10:21:25.990+0530 I  CONTROL  [initandlisten] now exiting
2020-03-31T10:21:25.991+0530 I  CONTROL  [initandlisten] shutting down with code:100

I do not know how the data path got changed. I have to change the MongoDB data path from C:\data\db\ to C:\Program Files\MongoDB\Server\4.2\data, so I tried changing it using the following command, but it doesn't recognize the path:

mongod --dbpath C:\Program Files\MongoDB\Server\4.2\data

What should be the format of the path to be entered here?

  • I would prefer to use/change the [Configuration File](https://docs.mongodb.com/manual/reference/configuration-options/index.html). It is set with the [--config](https://docs.mongodb.com/manual/reference/program/mongod/#cmdoption-mongod-config) option. When the path contains space characters you should enclose it by quotes. – Wernfried Domscheit Mar 31 '20 at 06:26
  • I already tried that, dbpath is set to the desired path in the config file [C:\Program Files\MongoDB\Server\4.2\data] , but whenever I start the mongodb server, is shows the data path as C:\data\db\ – devendramehta133 Mar 31 '20 at 06:57
  • How do you start the mongoDB? If the config files has spaces then you must also enclose it in quotes. `c:\data\db` is the default for `dbPath`, apparently the config file is not read. – Wernfried Domscheit Mar 31 '20 at 07:02

1 Answers1

1

Use CMD as a system administrator and type mongod --dbpath C:\myfolder\myproj\data\db"