You must have 3.2 to be able to upgrade to 3.4. This example assumes you are using apt.
sudo service mongod stop
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xeni...