Getting started with the MongoDB Java Driver Tutorial

Brief guide to running the MongoDB tutorial from QCon London and JAX London.

Setup

Create a new work area for this tutorial. For the rest of these instructions I’ll refer to it as <location>. I’ve put mine in ~/Documents/workshops/jax

Installing MongoDB

Download MongoDB or get it off the USB stick Unzip to an appropriate location, let’s say <location>/mongodb

Then we’ll have to create the directory for the data to go into:

cd <location>
mkdir data


And then start MongoDB:

./mongodb/bin/mongod –dbpath data

Now MongoDB should be running on localhost and port 27017

If you want, you can connect to the shell - this is not necessary for this workshop:

./mongodb/bin/mongo

Creating your project

Put the Java project into <location>/java3.0

cd < location>/java3.0

Run:
./gradlew idea

or
./gradlew eclipse

Open in your favourite IDE and you should be ready to start playing.

More help:

MongoDB Tutorials

Emergency Gradle Procedure:

Download Gradle or get it off the USB stick
Extract to some suitable location.  Mine’s in /Library/Tools/gradle/
Put gradle on your path.  On the Mac, that means adding the following line to ~/.bash_profile:
export PATH=“/Library/Tools/gradle/bin:$PATH”