Question1:Error while upgrading Mongodb from 3.2 to 3.6
在安装mongodb 4.X 版本前要先升级到3.6 Solution:
- 先卸载mongodb
- 再一个版本一个版本的安装
Uninstall your current mongodb
brew uninstall mongodb
Install mongodb 3.2 version
brew install mongodb@3.2
Start mongod 3.2 version (when you install the old version like above, you need the full path to run it.)
/usr/local/opt/mongodb@3.2/bin/mongod
Start mongo 3.2 version
/usr/local/opt/mongodb@3.2/bin/mongo
Run the important command
> db.adminCommand( { setFeatureCompatibilityVersion: "3.2" } )
Quit
>quit();
Terminate the mongod
Find PID of mongod process using $ top
Kill the process by $ kill <PID> (the Mongo docs have more info on this)
Uninstall mongodb 3.2
brew uninstall mongodb@3.2
Repeat the above steps for 3.4
Install mongodb 3.4 version
brew install mongodb@3.4
Start mongod 3.4 version
/usr/local/opt/mongodb@3.4/bin/mongod
Start mongo 3.4 version
/usr/local/opt/mongodb@3.4/bin/mongo
Run the important command
> db.adminCommand( { setFeatureCompatibilityVersion: "3.4" } )
...
Repeat the above steps for mongodb 3.6
...
Last, after uninstall 3.6, then you can install the most current version, 4.x, you don't have to specify the @4.x etc., just
Install the most current version
brew install mongodb