I followed the MongoDB Docs to run my MongoDB in macOS,
When I start MongoDB using the terminal get this error:
Shutting down with code: 62
I had a similar problem when I switched to a new version mongod
without upgrading the data (from version 3.2
, for example, to version 3.6
).
In this case, mongod
outputs ** IMPORTANT: UPGRADE PROBLEM: The data files need to be fully upgraded to version 3.4 before attempting an upgrade to 3.6; see http://dochub.mongodb.org/core/3.6-upgrade-fcv for more details.
(mongod
was started with the --verbose
key).
The link does lead to detailed instructions on how to upgrade the data.
It is strange that error 62
is not described in the documentation.
My errror started with an error 62.
2018-06-10T13:49:27.750-0400 I CONTROL [initandlisten] shutting down with code:62
I deleted /db and reinstalled /db in /data/db.
$ sudo -r rm db
Once I did this and tried to run >mongod I got a 100 error. I had to change the rights
2018-06-10T13:52:20.042-0400 I CONTROL [initandlisten] shutting down with code:100
To fix this I did:
$ sudo chown -R `id -un` /data/db
Once this was run I was able to run mongo db.
$mongod
I hope this helps.
Although the accepted answer works, it removes all your data.
What worked for me without need to lose my DB is using mongodump
to create a backup of the data. Then removing it by sudo rm -r /path/to/dbdata
and finally restoring it with mongorestore
.
That made systemctl start mongodb
to not fail and the data was in perfect state.
I ran into this issue on Arch Linux. I solved it by installing mongodb34-bin from the AUR (which required removing the mongodb package). Then I ran
$ sudo mongodb --repair
Then, I started the database from the 3.4 binary, and ran
$ mongo
> db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
{ "ok" : 1 }
> quit
After that, I stopped the 3.4 version, and reinstalled the regular mongodb package, and did a second repair.
In your directory C:, you may see the folder "data", and do:
mkdir -p data\db
in your command prompt in that location.
You can change back the binaries to Mongodb 3.4.2.3 to follow: Download tar from mongodb website as per your destribution from : https://www.mongodb.org/downloads Untar downloaded file.
tar -zxvf {mongo-tar-file}.tgz
Stop mongod service.
sudo service mongod stop
Replace binaries from your tar/bin to /usr/bin.
cd {your-extracted-folder}/bin
sudo mv -f * /usr/bin/
Start mongod service.
sudo service mongod start
and then when mongo running
again do: db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
Then you can update to 3.6