I'm currently building an application which makes heavy use of JSONB in PostgreSQL. After a while of searching I was unable to find any solution to people's questions about distinct JSONB keys across an entire table. Here are my findings and I hope it helps someone else.
Before attending I had intermediate understanding of how mongo worked in a production environment, but now I feel confident I could multiple machines, back them up and shard them with ease. It was also quite fun being a physical shard as part of Chris‘s role play example which helped to visual how data is actually managed and passed around the machines.
I'm even more excited for MongoDB UK tomorrow, which is of course, the main event. With speakers from AOL, Nokia, Cloud Foundry and gov.uk I'm sure there will be some amazing use cases to be learned from. I'll hopefully try and getting some posts written while I'm there tomorrow, and maybe even write up some coding examples from what I learn. Also looking forward to the Sharded pub crawl afterwards, but let's not tell the boss about that one!
# Sudo is required to install everything properly
if [ "$(whoami)" != "root" ]; then
echo "You need to use sudo to run this command"
echo "Installing MongoDB, please be patient, this could take a few minutes.."
REPOSOURCE="deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen"
# Make sure packages are up to date and key exists
apt-get update -qq && sudo apt-get upgrade -qq -y
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
# Append to repo
if ! grep -Fxq "$REPOSOURCE" $REPOFILE
echo ": Adding $REPOSOURCE to $REPOFILE"
echo "$REPOSOURCE" >> $REPOFILE
apt-get update -qq
# Run install
apt-get install -y mongodb-10gen
I normally put this in my home folder at ~/install-mongodb then run it using
sudo ./install-mongodb. Note that sudo is actually a requirement, and the script will warn you if it you don't have root permissions. I will add more scripts in the next few hours as I go through the MongoDB UK workshops to have simple ways of switching configs for different scenarios and replacing the defaults to enable auth, for example. If you have any cool things you'd like me to write about regarding MongoDB please feel free to ask in the comments.