blog

Upgrading MongoDB in Ubuntu 17.10 (Artful Aardvark) / using Mongo's own repository

This started with the following error in mongodump:

Failed: error dumping metadata: error converting index (<nil>): conversion of BSON value '2' of type 'bson.Decimal128' not supported

It seems that mongodump and the server got out of sync very roughly around Ubuntu 17.04. I *think* the troubled mongodump was associated with server version 3.2, and I'm almost certain my server version was 3.4 until I upgraded. Now I'm on server and dump version 3.6.3.

The following are my commands to fix the problem. See Mongo's instructions. I captured this history with "$ history | cut -c 8- " (without the quotes, and, hopefully, obviously without the $), courtesy of this StackOverflow and user Paul R.

As I write this, I'm not sure how I'll present it. Things went smoothly locally, then I had trouble on AWS (kwynn.com). I'm sure this isn't AWS or Ubuntu Server versions's fault. I haven't even studied my own traces, but I'd guess I ran the sequence differently. So I may dump the whole history without much editing, including my going around in circles. The short version is that I needed to use a Debian remove package command on AWS.

Upon further review, it seems things went wrong both times.

local trace


mongodump
[Houston...]
cd dump
cd [database name]
ls -l
[files are too short to have my data]
cat *
[yep, WAY too short]
mongodump --version
sudo apt-get install mongodb-org-tools
[doesn't help]
apt-cache search mongodb | grep tools
sudo apt-get install mongo-tools
[still doesn't help]
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install mongodb-org-tools
sudo apt-get remove mongo-tools
sudo apt-get install mongodb-org-tools
mongodump
[server not running, it seems]
sudo service mongodb start
[I believe this is the older, 3.4 daemon]
sudo service mongod start
[Now both 3.4 and 3.6 are running, I believe.  This can't be good.]
sudo apt-get install mongodb-org
sudo service mongodb start
sudo service mongod start
mongodump
cd dump
cd [db name]
ls -l
[much better]
cat notifcation.bson
[even better]
mongorestore
sudo service mongodb stop
sudo service mongod stop
sudo service mongod start
mongo
apt list --installed
apt list --installed | grep mongo
sudo systemctl enable mongod.service
[start mongo upon reboot]
sudo reboot
[test that notion]

AWS Ubuntu server-only trace


sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2930ADAE8CAF5059EE73BB4B58712A2291FA4AD5
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.6.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo apt-get remove mongo-tools
sudo apt --fix-broken install
sudo apt-get remove mongo-tools
sudo apt-get install  mongodb-org
sudo apt-get --fix-broken install  mongodb-org
sudo apt-get install mongodb-org-tools
sudo apt-get remove mongo-tools
sudo apt-get remove mongo-org-tools
sudo apt-get remove mongo-tools
sudo apt-get install mongodb-org-tools
sudo apt-get remove mongo-tools
sudo apt-get purge mongo-tools
sudo apt-get install mongodb-org
sudo dpkg -r mongo-tools
[finally!]
sudo apt-get install mongodb-org
sudo apt-get install mongodb-org-tools
sudo apt-get install mongodb-org
[probably just checking]
ps -Af | grep mongo
sudo systemctl enable mongod.service
sudo reboot

HTML5 valid