Generally to install MongoDB we use the following command.
npm install mongodb
If you want to install specific version of mongodb, for example if you want install 3.4.0 version you can use the following command.
npm install mongodb@3.4.0
In the same way if we want to install any version of mongodb we can use this format.
npm install mongodb@required_version