diff --git a/mongodb/pom.xml b/mongodb/pom.xml
index c78ee63c2e0daf476e70a47c1b783d1a67850f26..f004871b38bc369e145b1a9951bcbad88ea85306 100644
--- a/mongodb/pom.xml
+++ b/mongodb/pom.xml
@@ -1,64 +1,89 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>com.yahoo.ycsb</groupId>
-        <artifactId>binding-parent</artifactId>
-        <version>0.4.0-SNAPSHOT</version>
-        <relativePath>../binding-parent</relativePath>
-    </parent>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>com.yahoo.ycsb</groupId>
+    <artifactId>binding-parent</artifactId>
+    <version>0.4.0-SNAPSHOT</version>
+    <relativePath>../binding-parent</relativePath>
+  </parent>
 
-    <artifactId>mongodb-binding</artifactId>
-    <name>MongoDB Binding</name>
-    <packaging>jar</packaging>
+  <artifactId>mongodb-binding</artifactId>
+  <name>MongoDB Binding</name>
+  <packaging>jar</packaging>
 
-    <dependencies>
-        <dependency>
-            <groupId>org.mongodb</groupId>
-            <artifactId>mongo-java-driver</artifactId>
-            <version>${mongodb.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.allanbank</groupId>
-            <artifactId>mongodb-async-driver</artifactId>
-            <version>${mongodb.async.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>com.yahoo.ycsb</groupId>
-            <artifactId>core</artifactId>
-            <version>${project.version}</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>ch.qos.logback</groupId>
-            <artifactId>logback-classic</artifactId>
-            <version>1.1.2</version>
-            <scope>runtime</scope>
-        </dependency>
+  <dependencies>
+    <dependency>
+      <groupId>org.mongodb</groupId>
+      <artifactId>mongo-java-driver</artifactId>
+      <version>${mongodb.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.allanbank</groupId>
+      <artifactId>mongodb-async-driver</artifactId>
+      <version>${mongodb.async.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>com.yahoo.ycsb</groupId>
+      <artifactId>core</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+      <version>1.1.2</version>
+      <scope>runtime</scope>
+    </dependency>
 
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.12</version>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-    <repositories>
-        <repository>
-            <releases>
-                <enabled>true</enabled>
-                <updatePolicy>always</updatePolicy>
-                <checksumPolicy>warn</checksumPolicy>
-            </releases>
-            <snapshots>
-                <enabled>false</enabled>
-                <updatePolicy>never</updatePolicy>
-                <checksumPolicy>fail</checksumPolicy>
-            </snapshots>
-            <id>allanbank</id>
-            <name>Allanbank Releases</name>
-            <url>http://www.allanbank.com/repo/</url>
-            <layout>default</layout>
-        </repository>
-    </repositories>
- </project>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <version>2.15</version>
+        <configuration>
+          <consoleOutput>true</consoleOutput>
+          <configLocation>../checkstyle.xml</configLocation>
+          <failOnViolation>true</failOnViolation>
+          <failsOnError>true</failsOnError>
+        </configuration>
+        <executions>
+          <execution>
+            <id>validate</id>
+            <phase>validate</phase>
+            <goals>
+              <goal>checkstyle</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  <repositories>
+    <repository>
+      <releases>
+        <enabled>true</enabled>
+        <updatePolicy>always</updatePolicy>
+        <checksumPolicy>warn</checksumPolicy>
+      </releases>
+      <snapshots>
+        <enabled>false</enabled>
+        <updatePolicy>never</updatePolicy>
+        <checksumPolicy>fail</checksumPolicy>
+      </snapshots>
+      <id>allanbank</id>
+      <name>Allanbank Releases</name>
+      <url>http://www.allanbank.com/repo/</url>
+      <layout>default</layout>
+    </repository>
+  </repositories>
+</project>
diff --git a/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java b/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java
index 63ae2a7e41959ecc4e7b538aa436368e09b4a570..7db9b0b55e8900c9a00760d74248078863e3dd23 100644
--- a/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java
+++ b/mongodb/src/main/java/com/yahoo/ycsb/db/AsyncMongoDbClient.java
@@ -1,18 +1,18 @@
-/**                                                                                                                                                                                
- * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.                                                                                                                             
- *                                                                                                                                                                                 
- * Licensed under the Apache License, Version 2.0 (the "License"); you                                                                                                             
- * may not use this file except in compliance with the License. You                                                                                                                
- * may obtain a copy of the License at                                                                                                                                             
- *                                                                                                                                                                                 
- * http://www.apache.org/licenses/LICENSE-2.0                                                                                                                                      
- *                                                                                                                                                                                 
- * Unless required by applicable law or agreed to in writing, software                                                                                                             
- * distributed under the License is distributed on an "AS IS" BASIS,                                                                                                               
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or                                                                                                                 
- * implied. See the License for the specific language governing                                                                                                                    
- * permissions and limitations under the License. See accompanying                                                                                                                 
- * LICENSE file.                                                                                                                                                                   
+/*
+ * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you
+ * may not use this file except in compliance with the License. You
+ * may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License. See accompanying
+ * LICENSE file.
  */
 package com.yahoo.ycsb.db;
 
@@ -51,493 +51,481 @@ import com.yahoo.ycsb.DB;
 import com.yahoo.ycsb.DBException;
 
 /**
- * MongoDB asynchronous client for YCSB framework.
- * 
- * Properties to set:
- * 
- * mongodb.url=mongodb://localhost:27017 
- * mongodb.writeConcern=normal
- * 
+ * MongoDB asynchronous client for YCSB framework using the <a
+ * href="http://www.allanbank.com/mongodb-async-driver/">Asynchronous Java
+ * Driver</a>
+ * <p>
+ * See the <code>README.md</code> for configuration information.
+ * </p>
+ *
  * @author rjm
+ * @see <a href="http://www.allanbank.com/mongodb-async-driver/">Asynchronous
+ *      Java Driver</a>
  */
 public class AsyncMongoDbClient extends DB {
 
-    /** Used to include a field in a response. */
-    protected static final int INCLUDE = 1;
+  /** Used to include a field in a response. */
+  protected static final int INCLUDE = 1;
 
-    /** The database to use. */
-    private static String databaseName;
+  /** The database to use. */
+  private static String databaseName;
 
-    /** Thread local document builder. */
-    private static final ThreadLocal<DocumentBuilder> DOCUMENT_BUILDER = new ThreadLocal<DocumentBuilder>() {
+  /** Thread local document builder. */
+  private static final ThreadLocal<DocumentBuilder> DOCUMENT_BUILDER =
+      new ThreadLocal<DocumentBuilder>() {
         @Override
         protected DocumentBuilder initialValue() {
-            return BuilderFactory.start();
+          return BuilderFactory.start();
+        }
+      };
+
+  /** The write concern for the requests. */
+  private static final AtomicInteger INIT_COUNT = new AtomicInteger(0);
+
+  /** The connection to MongoDB. */
+  private static MongoClient mongoClient;
+
+  /** The write concern for the requests. */
+  private static Durability writeConcern;
+
+  /** Which servers to use for reads. */
+  private static ReadPreference readPreference;
+
+  /** The database to MongoDB. */
+  private MongoDatabase database;
+
+  /** The batch size to use for inserts. */
+  private static int batchSize;
+
+  /** The bulk inserts pending for the thread. */
+  private final BatchedWrite.Builder batchedWrite = BatchedWrite.builder()
+      .mode(BatchedWriteMode.REORDERED);
+
+  /** The number of writes in the batchedWrite. */
+  private int batchedWriteCount = 0;
+
+  /**
+   * Cleanup any state for this DB. Called once per DB instance; there is one DB
+   * instance per client thread.
+   */
+  @Override
+  public final void cleanup() throws DBException {
+    if (INIT_COUNT.decrementAndGet() == 0) {
+      try {
+        mongoClient.close();
+      } catch (final Exception e1) {
+        System.err.println("Could not close MongoDB connection pool: "
+            + e1.toString());
+        e1.printStackTrace();
+        return;
+      } finally {
+        mongoClient = null;
+        database = null;
+      }
+    }
+  }
+
+  /**
+   * Delete a record from the database.
+   * 
+   * @param table
+   *          The name of the table
+   * @param key
+   *          The record key of the record to delete.
+   * @return Zero on success, a non-zero error code on error. See this class's
+   *         description for a discussion of error codes.
+   */
+  @Override
+  public final int delete(final String table, final String key) {
+    try {
+      final MongoCollection collection = database.getCollection(table);
+      final Document q = BuilderFactory.start().add("_id", key).build();
+      final long res = collection.delete(q, writeConcern);
+      if (res == 0) {
+        System.err.println("Nothing deleted for key " + key);
+        return 1;
+      }
+      return 0;
+    } catch (final Exception e) {
+      System.err.println(e.toString());
+      return 1;
+    }
+  }
+
+  /**
+   * Initialize any state for this DB. Called once per DB instance; there is one
+   * DB instance per client thread.
+   */
+  @Override
+  public final void init() throws DBException {
+    final int count = INIT_COUNT.incrementAndGet();
+
+    synchronized (AsyncMongoDbClient.class) {
+      final Properties props = getProperties();
+
+      if (mongoClient != null) {
+        database = mongoClient.getDatabase(databaseName);
+
+        // If there are more threads (count) than connections then the
+        // Low latency spin lock is not really needed as we will keep
+        // the connections occupied.
+        if (count > mongoClient.getConfig().getMaxConnectionCount()) {
+          mongoClient.getConfig().setLockType(LockType.MUTEX);
         }
-    };
-
-    /** The write concern for the requests. */
-    private static final AtomicInteger initCount = new AtomicInteger(0);
-
-    /** The connection to MongoDB. */
-    private static MongoClient mongoClient;
-
-    /** The write concern for the requests. */
-    private static Durability writeConcern;
 
-    /** Which servers to use for reads. */
-    private static ReadPreference readPreference;
+        return;
+      }
+
+      // Set insert batchsize, default 1 - to be YCSB-original equivalent
+      batchSize = Integer.parseInt(props.getProperty("mongodb.batchsize", "1"));
+
+      // Just use the standard connection format URL
+      // http://docs.mongodb.org/manual/reference/connection-string/
+      // to configure the client.
+      String url =
+          props
+              .getProperty("mongodb.url", "mongodb://localhost:27017/ycsb?w=1");
+      if (!url.startsWith("mongodb://")) {
+        System.err.println("ERROR: Invalid URL: '" + url
+            + "'. Must be of the form "
+            + "'mongodb://<host1>:<port1>,<host2>:<port2>/database?"
+            + "options'. See "
+            + "http://docs.mongodb.org/manual/reference/connection-string/.");
+        System.exit(1);
+      }
+
+      MongoDbUri uri = new MongoDbUri(url);
+
+      try {
+        databaseName = uri.getDatabase();
+        if ((databaseName == null) || databaseName.isEmpty()) {
+          // Default database is "ycsb" if database is not
+          // specified in URL
+          databaseName = "ycsb";
+        }
 
-    /** The database to MongoDB. */
-    private MongoDatabase database;
+        mongoClient = MongoFactory.createClient(uri);
 
-    /** The batch size to use for inserts. */
-    private static int batchSize;
+        MongoClientConfiguration config = mongoClient.getConfig();
+        if (!url.toLowerCase().contains("locktype=")) {
+          config.setLockType(LockType.LOW_LATENCY_SPIN); // assumed...
+        }
 
-    /** The bulk inserts pending for the thread. */
-    private final BatchedWrite.Builder batchedWrite = BatchedWrite.builder()
-            .mode(BatchedWriteMode.REORDERED);
+        readPreference = config.getDefaultReadPreference();
+        writeConcern = config.getDefaultDurability();
 
-    /** The number of writes in the batchedWrite. */
-    private int batchedWriteCount = 0;
+        database = mongoClient.getDatabase(databaseName);
 
-    /**
-     * Cleanup any state for this DB. Called once per DB instance; there is one
-     * DB instance per client thread.
-     */
-    @Override
-    public final void cleanup() throws DBException {
-        if (initCount.decrementAndGet() == 0) {
-            try {
-                mongoClient.close();
-            }
-            catch (final Exception e1) {
-                System.err.println("Could not close MongoDB connection pool: "
-                        + e1.toString());
-                e1.printStackTrace();
-                return;
-            }
-            finally {
-                mongoClient = null;
-                database = null;
-            }
-        }
+        System.out.println("mongo connection created with " + url);
+      } catch (final Exception e1) {
+        System.err
+            .println("Could not initialize MongoDB connection pool for Loader: "
+                + e1.toString());
+        e1.printStackTrace();
+        return;
+      }
     }
-
-    /**
-     * Delete a record from the database.
-     * 
-     * @param table
-     *            The name of the table
-     * @param key
-     *            The record key of the record to delete.
-     * @return Zero on success, a non-zero error code on error. See this class's
-     *         description for a discussion of error codes.
-     */
-    @Override
-    public final int delete(final String table, final String key) {
-        try {
-            final MongoCollection collection = database.getCollection(table);
-            final Document q = BuilderFactory.start().add("_id", key).build();
-            final long res = collection.delete(q, writeConcern);
-            if (res == 0) {
-                System.err.println("Nothing deleted for key " + key);
-                return 1;
-            }
-            return 0;
+  }
+
+  /**
+   * Insert a record in the database. Any field/value pairs in the specified
+   * values HashMap will be written into the record with the specified record
+   * key.
+   * 
+   * @param table
+   *          The name of the table
+   * @param key
+   *          The record key of the record to insert.
+   * @param values
+   *          A HashMap of field/value pairs to insert in the record
+   * @return Zero on success, a non-zero error code on error. See the {@link DB}
+   *         class's description for a discussion of error codes.
+   */
+  @Override
+  public final int insert(final String table, final String key,
+      final HashMap<String, ByteIterator> values) {
+    try {
+      final MongoCollection collection = database.getCollection(table);
+      final DocumentBuilder toInsert =
+          DOCUMENT_BUILDER.get().reset().add("_id", key);
+      final Document query = toInsert.build();
+      for (final Map.Entry<String, ByteIterator> entry : values.entrySet()) {
+        toInsert.add(entry.getKey(), entry.getValue().toArray());
+      }
+
+      // Do an upsert.
+      if (batchSize <= 1) {
+        long result = collection.update(query, toInsert,
+        /* multi= */false, /* upsert= */true, writeConcern);
+
+        return result == 1 ? 0 : 1;
+      }
+
+      // Use a bulk insert.
+      try {
+        batchedWrite.insert(toInsert);
+        batchedWriteCount += 1;
+
+        if (batchedWriteCount < batchSize) {
+          return 0;
         }
-        catch (final Exception e) {
-            System.err.println(e.toString());
-            return 1;
-        }
-    }
 
-    /**
-     * Initialize any state for this DB. Called once per DB instance; there is
-     * one DB instance per client thread.
-     */
-    @Override
-    public final void init() throws DBException {
-        final int count = initCount.incrementAndGet();
-
-        synchronized (AsyncMongoDbClient.class) {
-            final Properties props = getProperties();
-
-            if (mongoClient != null) {
-                database = mongoClient.getDatabase(databaseName);
-
-                // If there are more threads (count) than connections then the
-                // Low latency spin lock is not really needed as we will keep
-                // the connections occupied.
-                if (count > mongoClient.getConfig().getMaxConnectionCount()) {
-                    mongoClient.getConfig().setLockType(LockType.MUTEX);
-                }
-
-                return;
-            }
-
-            // Set insert batchsize, default 1 - to be YCSB-original equivalent
-            batchSize = Integer.parseInt(props.getProperty("mongodb.batchsize", "1"));
-
-            // Just use the standard connection format URL
-            // http://docs.mongodb.org/manual/reference/connection-string/ 
-            // to configure the client.
-            String url = props.getProperty("mongodb.url",
-                    "mongodb://localhost:27017/ycsb?w=1");
-            if (!url.startsWith("mongodb://")) {
-                System.err
-                        .println("ERROR: Invalid URL: '"
-                                + url
-                                + "'. Must be of the form "
-                                + "'mongodb://<host1>:<port1>,<host2>:<port2>/database?options'. "
-                                + "See http://docs.mongodb.org/manual/reference/connection-string/.");
-                System.exit(1);
-            }
-
-            MongoDbUri uri = new MongoDbUri(url);
-
-            try {
-                databaseName = uri.getDatabase();
-                if ((databaseName == null) || databaseName.isEmpty()) {
-                    // Default database is "ycsb" if database is not 
-                    // specified in URL
-                    databaseName="ycsb";
-                }
-
-                mongoClient = MongoFactory.createClient(uri);
-
-                MongoClientConfiguration config = mongoClient.getConfig();
-                if (!url.toLowerCase().contains("locktype=")) {
-                    config.setLockType(LockType.LOW_LATENCY_SPIN); // assumed...
-                }
-
-                readPreference = config.getDefaultReadPreference();
-                writeConcern = config.getDefaultDurability();
-
-                database = mongoClient.getDatabase(databaseName);
-
-                System.out.println("mongo connection created with " + url);
-            }
-            catch (final Exception e1) {
-                System.err
-                        .println("Could not initialize MongoDB connection pool for Loader: "
-                                + e1.toString());
-                e1.printStackTrace();
-                return;
-            }
+        long count = collection.write(batchedWrite);
+        if (count == batchedWriteCount) {
+          batchedWrite.reset().mode(BatchedWriteMode.REORDERED);
+          batchedWriteCount = 0;
+          return 0;
         }
-    }
 
-    /**
-     * Insert a record in the database. Any field/value pairs in the specified
-     * values HashMap will be written into the record with the specified record
-     * key.
-     * 
-     * @param table
-     *            The name of the table
-     * @param key
-     *            The record key of the record to insert.
-     * @param values
-     *            A HashMap of field/value pairs to insert in the record
-     * @return Zero on success, a non-zero error code on error. See the
-     *         {@link DB} class's description for a discussion of error codes.
-     */
-    @Override
-    public final int insert(final String table, final String key,
-            final HashMap<String, ByteIterator> values) {
-        try {
-            final MongoCollection collection = database.getCollection(table);
-            final DocumentBuilder toInsert = DOCUMENT_BUILDER.get().reset()
-                    .add("_id", key);
-            final Document query = toInsert.build();
-            for (final Map.Entry<String, ByteIterator> entry : values
-                    .entrySet()) {
-                toInsert.add(entry.getKey(), entry.getValue().toArray());
-            }
-
-            // Do an upsert.
-            if (batchSize <= 1) {
-                long result = collection.update(query, toInsert,
-                /* multi= */false, /* upsert= */true, writeConcern);
-
-                return result == 1 ? 0 : 1;
-            }
-
-            // Use a bulk insert.
-            try {
-                batchedWrite.insert(toInsert);
-                batchedWriteCount += 1;
-
-                if (batchedWriteCount < batchSize) {
-                    return 0;
-                }
-
-                long count = collection.write(batchedWrite);
-                if (count == batchedWriteCount) {
-                    batchedWrite.reset().mode(BatchedWriteMode.REORDERED);
-                    batchedWriteCount = 0;
-                    return 0;
-                }
-
-                System.err
-                        .println("Number of inserted documents doesn't match the number sent, "
-                                + count
-                                + " inserted, sent "
-                                + batchedWriteCount);
-                batchedWrite.reset().mode(BatchedWriteMode.REORDERED);
-                batchedWriteCount = 0;
-                return 1;
-            }
-            catch (Exception e) {
-                System.err.println("Exception while trying bulk insert with "
-                        + batchedWriteCount);
-                e.printStackTrace();
-                return 1;
-            }
+        System.err.println("Number of inserted documents doesn't match the "
+            + "number sent, " + count + " inserted, sent " + batchedWriteCount);
+        batchedWrite.reset().mode(BatchedWriteMode.REORDERED);
+        batchedWriteCount = 0;
+        return 1;
+      } catch (Exception e) {
+        System.err.println("Exception while trying bulk insert with "
+            + batchedWriteCount);
+        e.printStackTrace();
+        return 1;
+      }
+    } catch (final Exception e) {
+      e.printStackTrace();
+      return 1;
+    }
+  }
+
+  /**
+   * Read a record from the database. Each field/value pair from the result will
+   * be stored in a HashMap.
+   * 
+   * @param table
+   *          The name of the table
+   * @param key
+   *          The record key of the record to read.
+   * @param fields
+   *          The list of fields to read, or null for all of them
+   * @param result
+   *          A HashMap of field/value pairs for the result
+   * @return Zero on success, a non-zero error code on error or "not found".
+   */
+  @Override
+  public final int read(final String table, final String key,
+      final Set<String> fields, final HashMap<String, ByteIterator> result) {
+    try {
+      final MongoCollection collection = database.getCollection(table);
+      final DocumentBuilder query =
+          DOCUMENT_BUILDER.get().reset().add("_id", key);
+
+      Document queryResult = null;
+      if (fields != null) {
+        final DocumentBuilder fieldsToReturn = BuilderFactory.start();
+        final Iterator<String> iter = fields.iterator();
+        while (iter.hasNext()) {
+          fieldsToReturn.add(iter.next(), 1);
         }
-        catch (final Exception e) {
-            e.printStackTrace();
-            return 1;
+
+        final Find.Builder fb = new Find.Builder(query);
+        fb.projection(fieldsToReturn);
+        fb.setLimit(1);
+        fb.setBatchSize(1);
+        fb.readPreference(readPreference);
+
+        final MongoIterator<Document> ci = collection.find(fb.build());
+        if (ci.hasNext()) {
+          queryResult = ci.next();
+          ci.close();
         }
+      } else {
+        queryResult = collection.findOne(query);
+      }
+
+      if (queryResult != null) {
+        fillMap(result, queryResult);
+      }
+      return queryResult != null ? 0 : 1;
+    } catch (final Exception e) {
+      System.err.println(e.toString());
+      return 1;
     }
 
-    /**
-     * Read a record from the database. Each field/value pair from the result
-     * will be stored in a HashMap.
-     * 
-     * @param table
-     *            The name of the table
-     * @param key
-     *            The record key of the record to read.
-     * @param fields
-     *            The list of fields to read, or null for all of them
-     * @param result
-     *            A HashMap of field/value pairs for the result
-     * @return Zero on success, a non-zero error code on error or "not found".
-     */
-    @Override
-    public final int read(final String table, final String key,
-            final Set<String> fields, final HashMap<String, ByteIterator> result) {
-        try {
-            final MongoCollection collection = database.getCollection(table);
-            final DocumentBuilder query = DOCUMENT_BUILDER.get().reset()
-                    .add("_id", key);
-
-            Document queryResult = null;
-            if (fields != null) {
-                final DocumentBuilder fieldsToReturn = BuilderFactory.start();
-                final Iterator<String> iter = fields.iterator();
-                while (iter.hasNext()) {
-                    fieldsToReturn.add(iter.next(), 1);
-                }
-
-                final Find.Builder fb = new Find.Builder(query);
-                fb.projection(fieldsToReturn);
-                fb.setLimit(1);
-                fb.setBatchSize(1);
-                fb.readPreference(readPreference);
-
-                final MongoIterator<Document> ci = collection.find(fb.build());
-                if (ci.hasNext()) {
-                    queryResult = ci.next();
-                    ci.close();
-                }
-            }
-            else {
-                queryResult = collection.findOne(query);
-            }
-
-            if (queryResult != null) {
-                fillMap(result, queryResult);
-            }
-            return queryResult != null ? 0 : 1;
-        }
-        catch (final Exception e) {
-            System.err.println(e.toString());
-            return 1;
+  }
+
+  /**
+   * Perform a range scan for a set of records in the database. Each field/value
+   * pair from the result will be stored in a HashMap.
+   * 
+   * @param table
+   *          The name of the table
+   * @param startkey
+   *          The record key of the first record to read.
+   * @param recordcount
+   *          The number of records to read
+   * @param fields
+   *          The list of fields to read, or null for all of them
+   * @param result
+   *          A Vector of HashMaps, where each HashMap is a set field/value
+   *          pairs for one record
+   * @return Zero on success, a non-zero error code on error. See the {@link DB}
+   *         class's description for a discussion of error codes.
+   */
+  @Override
+  public final int scan(final String table, final String startkey,
+      final int recordcount, final Set<String> fields,
+      final Vector<HashMap<String, ByteIterator>> result) {
+    try {
+      final MongoCollection collection = database.getCollection(table);
+
+      final Find.Builder find =
+          Find.builder().query(where("_id").greaterThanOrEqualTo(startkey))
+              .limit(recordcount).batchSize(recordcount).sort(Sort.asc("_id"))
+              .readPreference(readPreference);
+
+      if (fields != null) {
+        final DocumentBuilder fieldsDoc = BuilderFactory.start();
+        for (final String field : fields) {
+          fieldsDoc.add(field, INCLUDE);
         }
 
+        find.projection(fieldsDoc);
+      }
+
+      result.ensureCapacity(recordcount);
+
+      final MongoIterator<Document> cursor = collection.find(find);
+      if (!cursor.hasNext()) {
+        System.err.println("Nothing found in scan for key " + startkey);
+        return 1;
+      }
+      while (cursor.hasNext()) {
+        // toMap() returns a Map but result.add() expects a
+        // Map<String,String>. Hence, the suppress warnings.
+        final Document doc = cursor.next();
+        final HashMap<String, ByteIterator> docAsMap =
+            new HashMap<String, ByteIterator>();
+
+        fillMap(docAsMap, doc);
+
+        result.add(docAsMap);
+      }
+
+      return 0;
+    } catch (final Exception e) {
+      System.err.println(e.toString());
+      return 1;
+    }
+  }
+
+  /**
+   * Update a record in the database. Any field/value pairs in the specified
+   * values HashMap will be written into the record with the specified record
+   * key, overwriting any existing values with the same field name.
+   * 
+   * @param table
+   *          The name of the table
+   * @param key
+   *          The record key of the record to write.
+   * @param values
+   *          A HashMap of field/value pairs to update in the record
+   * @return Zero on success, a non-zero error code on error. See the {@link DB}
+   *         class's description for a discussion of error codes.
+   */
+  @Override
+  public final int update(final String table, final String key,
+      final HashMap<String, ByteIterator> values) {
+    try {
+      final MongoCollection collection = database.getCollection(table);
+      final DocumentBuilder query = BuilderFactory.start().add("_id", key);
+      final DocumentBuilder update = BuilderFactory.start();
+      final DocumentBuilder fieldsToSet = update.push("$set");
+
+      for (final Map.Entry<String, ByteIterator> entry : values.entrySet()) {
+        fieldsToSet.add(entry.getKey(), entry.getValue().toArray());
+      }
+      final long res =
+          collection.update(query, update, false, false, writeConcern);
+      return res == 1 ? 0 : 1;
+    } catch (final Exception e) {
+      System.err.println(e.toString());
+      return 1;
     }
+  }
+
+  /**
+   * Fills the map with the ByteIterators from the document.
+   * 
+   * @param result
+   *          The map to fill.
+   * @param queryResult
+   *          The document to fill from.
+   */
+  protected final void fillMap(final HashMap<String, ByteIterator> result,
+      final Document queryResult) {
+    for (final Element be : queryResult) {
+      if (be.getType() == ElementType.BINARY) {
+        result.put(be.getName(),
+            new BinaryByteArrayIterator((BinaryElement) be));
+      }
+    }
+  }
+
+  /**
+   * BinaryByteArrayIterator provides an adapter from a {@link BinaryElement} to
+   * a {@link ByteIterator}.
+   */
+  private static final class BinaryByteArrayIterator extends ByteIterator {
+
+    /** The binary data. */
+    private final BinaryElement binaryElement;
+
+    /** The current offset into the binary element. */
+    private int offset;
 
     /**
-     * Perform a range scan for a set of records in the database. Each
-     * field/value pair from the result will be stored in a HashMap.
+     * Creates a new BinaryByteArrayIterator.
      * 
-     * @param table
-     *            The name of the table
-     * @param startkey
-     *            The record key of the first record to read.
-     * @param recordcount
-     *            The number of records to read
-     * @param fields
-     *            The list of fields to read, or null for all of them
-     * @param result
-     *            A Vector of HashMaps, where each HashMap is a set field/value
-     *            pairs for one record
-     * @return Zero on success, a non-zero error code on error. See the
-     *         {@link DB} class's description for a discussion of error codes.
+     * @param element
+     *          The {@link BinaryElement} to iterate over.
      */
-    @Override
-    public final int scan(final String table, final String startkey,
-            final int recordcount, final Set<String> fields,
-            final Vector<HashMap<String, ByteIterator>> result) {
-        try {
-            final MongoCollection collection = database.getCollection(table);
-
-            final Find.Builder find = Find.builder()
-                    .query(where("_id").greaterThanOrEqualTo(startkey))
-                    .limit(recordcount).batchSize(recordcount)
-                    .sort(Sort.asc("_id")).readPreference(readPreference);
-
-            if (fields != null) {
-                final DocumentBuilder fieldsDoc = BuilderFactory.start();
-                for (final String field : fields) {
-                    fieldsDoc.add(field, INCLUDE);
-                }
-
-                find.projection(fieldsDoc);
-            }
-
-            result.ensureCapacity(recordcount);
-
-            final MongoIterator<Document> cursor = collection.find(find);
-            if (!cursor.hasNext()) {
-                System.err.println("Nothing found in scan for key " + startkey);
-                return 1;
-            }
-            while (cursor.hasNext()) {
-                // toMap() returns a Map but result.add() expects a
-                // Map<String,String>. Hence, the suppress warnings.
-                final Document doc = cursor.next();
-                final HashMap<String, ByteIterator> docAsMap = new HashMap<String, ByteIterator>();
-
-                fillMap(docAsMap, doc);
-
-                result.add(docAsMap);
-            }
-
-            return 0;
-        }
-        catch (final Exception e) {
-            System.err.println(e.toString());
-            return 1;
-        }
+    public BinaryByteArrayIterator(final BinaryElement element) {
+      this.binaryElement = element;
+      this.offset = 0;
     }
 
     /**
-     * Update a record in the database. Any field/value pairs in the specified
-     * values HashMap will be written into the record with the specified record
-     * key, overwriting any existing values with the same field name.
-     * 
-     * @param table
-     *            The name of the table
-     * @param key
-     *            The record key of the record to write.
-     * @param values
-     *            A HashMap of field/value pairs to update in the record
-     * @return Zero on success, a non-zero error code on error. See the
-     *         {@link DB} class's description for a discussion of error codes.
+     * {@inheritDoc}
+     * <p>
+     * Overridden to return the number of bytes remaining in the iterator.
+     * </p>
      */
     @Override
-    public final int update(final String table, final String key,
-            final HashMap<String, ByteIterator> values) {
-        try {
-            final MongoCollection collection = database.getCollection(table);
-            final DocumentBuilder query = BuilderFactory.start()
-                    .add("_id", key);
-            final DocumentBuilder update = BuilderFactory.start();
-            final DocumentBuilder fieldsToSet = update.push("$set");
-
-            for (final Map.Entry<String, ByteIterator> entry : values
-                    .entrySet()) {
-                fieldsToSet.add(entry.getKey(), entry.getValue().toArray());
-            }
-            final long res = collection.update(query, update, false, false,
-                    writeConcern);
-            return res == 1 ? 0 : 1;
-        }
-        catch (final Exception e) {
-            System.err.println(e.toString());
-            return 1;
-        }
+    public long bytesLeft() {
+      return Math.max(0, binaryElement.length() - offset);
     }
 
     /**
-     * Fills the map with the ByteIterators from the document.
-     * 
-     * @param result
-     *            The map to fill.
-     * @param queryResult
-     *            The document to fill from.
+     * {@inheritDoc}
+     * <p>
+     * Overridden to return true if there is more data in the
+     * {@link BinaryElement}.
+     * </p>
      */
-    protected final void fillMap(final HashMap<String, ByteIterator> result,
-            final Document queryResult) {
-        for (final Element be : queryResult) {
-            if (be.getType() == ElementType.BINARY) {
-                result.put(be.getName(), new BinaryByteArrayIterator(
-                        (BinaryElement) be));
-            }
-        }
+    @Override
+    public boolean hasNext() {
+      return (offset < binaryElement.length());
     }
 
     /**
-     * BinaryByteArrayIterator provides an adapter from a {@link BinaryElement}
-     * to a {@link ByteIterator}.
+     * {@inheritDoc}
+     * <p>
+     * Overridden to return the next value and advance the iterator.
+     * </p>
      */
-    private final static class BinaryByteArrayIterator extends ByteIterator {
-
-        /** The binary data. */
-        private final BinaryElement binaryElement;
-
-        /** The current offset into the binary element. */
-        private int offset;
-
-        /**
-         * Creates a new BinaryByteArrayIterator.
-         * 
-         * @param element
-         *            The {@link BinaryElement} to iterate over.
-         */
-        public BinaryByteArrayIterator(final BinaryElement element) {
-            this.binaryElement = element;
-            this.offset = 0;
-        }
-
-        /**
-         * {@inheritDoc}
-         * <p>
-         * Overridden to return the number of bytes remaining in the iterator.
-         * </p>
-         */
-        @Override
-        public long bytesLeft() {
-            return Math.max(0, binaryElement.length() - offset);
-        }
-
-        /**
-         * {@inheritDoc}
-         * <p>
-         * Overridden to return true if there is more data in the
-         * {@link BinaryElement}.
-         * </p>
-         */
-        @Override
-        public boolean hasNext() {
-            return (offset < binaryElement.length());
-        }
-
-        /**
-         * {@inheritDoc}
-         * <p>
-         * Overridden to return the next value and advance the iterator.
-         * </p>
-         */
-        @Override
-        public byte nextByte() {
-            final byte value = binaryElement.get(offset);
-            offset += 1;
+    @Override
+    public byte nextByte() {
+      final byte value = binaryElement.get(offset);
+      offset += 1;
 
-            return value;
-        }
+      return value;
     }
+  }
 }
diff --git a/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java b/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java
index 644c9fcb5e41a53a22e12ee74344fbae2503b9f6..e1aac64559a04e9f5322668f71eae03d1d5fe1b6 100644
--- a/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java
+++ b/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java
@@ -1,12 +1,10 @@
-/**
+/*
  * MongoDB client binding for YCSB.
  *
  * Submitted by Yen Pai on 5/11/2010.
  *
  * https://gist.github.com/000a66b8db2caf42467b#file_mongo_database.java
- *
  */
-
 package com.yahoo.ycsb.db;
 
 import java.util.ArrayList;
@@ -18,7 +16,6 @@ import java.util.Set;
 import java.util.Vector;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import com.mongodb.client.model.Filters;
 import com.mongodb.client.model.InsertManyOptions;
 import org.bson.Document;
 import org.bson.types.Binary;
@@ -40,410 +37,391 @@ import com.yahoo.ycsb.DB;
 import com.yahoo.ycsb.DBException;
 
 /**
- * MongoDB client for YCSB framework.
- * 
- * Properties to set:
- * 
- * mongodb.url=mongodb://localhost:27017
- * mongodb.writeConcern=acknowledged
+ * MongoDB asynchronous client for YCSB framework using the MongoDB Inc. <a
+ * href="http://docs.mongodb.org/ecosystem/drivers/java/">driver</a>
+ * <p>
+ * See the <code>README.md</code> for configuration information.
+ * </p>
  * 
  * @author ypai
+ * @see <a href="http://docs.mongodb.org/ecosystem/drivers/java/">MongoDB Inc.
+ *      driver</a>
  */
 public class MongoDbClient extends DB {
 
-    /** Used to include a field in a response. */
-    private static final Integer INCLUDE = Integer.valueOf(1);
-
-    /** The options to use for inserting many documents */
-    private static final InsertManyOptions INSERT_UNORDERED =
-    new InsertManyOptions().ordered(false);
-
-    /** The options to use for inserting a single document */
-    private static final UpdateOptions UPDATE_WITH_UPSERT =
-    new UpdateOptions().upsert(true);
-
-    /**
-     * The database name to access.
-     */
-    private static String databaseName;
-
-    /** The database name to access. */
-    private static MongoDatabase database;
-
-    /**
-     * Count the number of times initialized to teardown on the last
-     * {@link #cleanup()}.
-     */
-    private static final AtomicInteger initCount = new AtomicInteger(0);
-
-    /** A singleton Mongo instance. */
-    private static MongoClient mongoClient;
-
-    /** The default read preference for the test */
-    private static ReadPreference readPreference;
-
-    /** The default write concern for the test. */
-    private static WriteConcern writeConcern;
-
-    /** The batch size to use for inserts. */
-    private static int batchSize;
-
-    /** The bulk inserts pending for the thread. */
-    private final List<Document> bulkInserts = new ArrayList<Document>();
-
-    /**
-     * Cleanup any state for this DB. Called once per DB instance; there is one
-     * DB instance per client thread.
-     */
-    @Override
-    public void cleanup() throws DBException {
-        if (initCount.decrementAndGet() == 0) {
-            try {
-                mongoClient.close();
-            }
-            catch (Exception e1) {
-                System.err.println("Could not close MongoDB connection pool: "
-                        + e1.toString());
-                e1.printStackTrace();
-                return;
-            }
-            finally {
-                database = null;
-                mongoClient = null;
-            }
-        }
+  /** Used to include a field in a response. */
+  private static final Integer INCLUDE = Integer.valueOf(1);
+
+  /** The options to use for inserting many documents. */
+  private static final InsertManyOptions INSERT_UNORDERED =
+      new InsertManyOptions().ordered(false);
+
+  /** The options to use for inserting a single document. */
+  private static final UpdateOptions UPDATE_WITH_UPSERT = new UpdateOptions()
+      .upsert(true);
+
+  /**
+   * The database name to access.
+   */
+  private static String databaseName;
+
+  /** The database name to access. */
+  private static MongoDatabase database;
+
+  /**
+   * Count the number of times initialized to teardown on the last
+   * {@link #cleanup()}.
+   */
+  private static final AtomicInteger INIT_COUNT = new AtomicInteger(0);
+
+  /** A singleton Mongo instance. */
+  private static MongoClient mongoClient;
+
+  /** The default read preference for the test. */
+  private static ReadPreference readPreference;
+
+  /** The default write concern for the test. */
+  private static WriteConcern writeConcern;
+
+  /** The batch size to use for inserts. */
+  private static int batchSize;
+
+  /** The bulk inserts pending for the thread. */
+  private final List<Document> bulkInserts = new ArrayList<Document>();
+
+  /**
+   * Cleanup any state for this DB. Called once per DB instance; there is one DB
+   * instance per client thread.
+   */
+  @Override
+  public void cleanup() throws DBException {
+    if (INIT_COUNT.decrementAndGet() == 0) {
+      try {
+        mongoClient.close();
+      } catch (Exception e1) {
+        System.err.println("Could not close MongoDB connection pool: "
+            + e1.toString());
+        e1.printStackTrace();
+        return;
+      } finally {
+        database = null;
+        mongoClient = null;
+      }
+    }
+  }
+
+  /**
+   * Delete a record from the database.
+   * 
+   * @param table
+   *          The name of the table
+   * @param key
+   *          The record key of the record to delete.
+   * @return Zero on success, a non-zero error code on error. See the {@link DB}
+   *         class's description for a discussion of error codes.
+   */
+  @Override
+  public int delete(String table, String key) {
+    try {
+      MongoCollection<Document> collection = database.getCollection(table);
+
+      Document query = new Document("_id", key);
+      DeleteResult result =
+          collection.withWriteConcern(writeConcern).deleteOne(query);
+      if (result.wasAcknowledged() && result.getDeletedCount() == 0) {
+        System.err.println("Nothing deleted for key " + key);
+        return 1;
+      }
+      return 0;
+    } catch (Exception e) {
+      System.err.println(e.toString());
+      return 1;
     }
+  }
+
+  /**
+   * Initialize any state for this DB. Called once per DB instance; there is one
+   * DB instance per client thread.
+   */
+  @Override
+  public void init() throws DBException {
+    INIT_COUNT.incrementAndGet();
+    synchronized (INCLUDE) {
+      if (mongoClient != null) {
+        return;
+      }
+
+      Properties props = getProperties();
+
+      // Set insert batchsize, default 1 - to be YCSB-original equivalent
+      batchSize = Integer.parseInt(props.getProperty("batchsize", "1"));
+
+      // Just use the standard connection format URL
+      // http://docs.mongodb.org/manual/reference/connection-string/
+      // to configure the client.
+      String url = props.getProperty("mongodb.url", null);
+      boolean defaultedUrl = false;
+      if (url == null) {
+        defaultedUrl = true;
+        url = "mongodb://localhost:27017/ycsb?w=1";
+      }
+
+      url = OptionsSupport.updateUrl(url, props);
+
+      if (!url.startsWith("mongodb://")) {
+        System.err.println("ERROR: Invalid URL: '" + url
+            + "'. Must be of the form "
+            + "'mongodb://<host1>:<port1>,<host2>:<port2>/database?options'. "
+            + "http://docs.mongodb.org/manual/reference/connection-string/");
+        System.exit(1);
+      }
+
+      try {
+        MongoClientURI uri = new MongoClientURI(url);
+
+        String uriDb = uri.getDatabase();
+        if (!defaultedUrl && (uriDb != null) && !uriDb.isEmpty()
+            && !"admin".equals(uriDb)) {
+          databaseName = uriDb;
+        } else {
+          // If no database is specified in URI, use "ycsb"
+          databaseName = "ycsb";
 
-    /**
-     * Delete a record from the database.
-     * 
-     * @param table
-     *            The name of the table
-     * @param key
-     *            The record key of the record to delete.
-     * @return Zero on success, a non-zero error code on error. See the
-     *         {@link DB} class's description for a discussion of error codes.
-     */
-    @Override
-    public int delete(String table, String key) {
-        try {
-            MongoCollection<Document> collection = database
-                    .getCollection(table);
-
-            Document query = new Document("_id", key);
-            DeleteResult result = collection.withWriteConcern(writeConcern)
-                    .deleteOne(query);
-            if (result.wasAcknowledged() && result.getDeletedCount() == 0) {
-                System.err.println("Nothing deleted for key " + key);
-                return 1;
-            }
-            return 0;
         }
-        catch (Exception e) {
-            System.err.println(e.toString());
-            return 1;
-        }
-    }
 
-    /**
-     * Initialize any state for this DB. Called once per DB instance; there is
-     * one DB instance per client thread.
-     */
-    @Override
-    public void init() throws DBException {
-        initCount.incrementAndGet();
-        synchronized (INCLUDE) {
-            if (mongoClient != null) {
-                return;
-            }
-
-            Properties props = getProperties();
-
-            // Set insert batchsize, default 1 - to be YCSB-original equivalent
-            batchSize = Integer.parseInt(props.getProperty("batchsize", "1"));
-
-            // Just use the standard connection format URL
-            // http://docs.mongodb.org/manual/reference/connection-string/ 
-            // to configure the client.
-            String url = props.getProperty("mongodb.url", null);
-            boolean defaultedUrl = false;
-            if (url == null) {
-                defaultedUrl = true;
-                url = "mongodb://localhost:27017/ycsb?w=1";
-            }
-
-            url = OptionsSupport.updateUrl(url, props);
-
-            if (!url.startsWith("mongodb://")) {
-                System.err
-                        .println("ERROR: Invalid URL: '"
-                                + url
-                                + "'. Must be of the form "
-                                + "'mongodb://<host1>:<port1>,<host2>:<port2>/database?options'. "
-                                + "http://docs.mongodb.org/manual/reference/connection-string/");
-                System.exit(1);
-            }
-
-            try {
-                MongoClientURI uri = new MongoClientURI(url);
-
-                String uriDb = uri.getDatabase();
-                if (!defaultedUrl && (uriDb != null) && !uriDb.isEmpty()
-                        && !"admin".equals(uriDb)) {
-                    databaseName = uriDb;
-                }
-                else {
-                    //If no database is specified in URI, use "ycsb"
-                    databaseName = "ycsb"; 
-
-                }
-
-
-                readPreference = uri.getOptions().getReadPreference();
-                writeConcern = uri.getOptions().getWriteConcern();
-
-                mongoClient = new MongoClient(uri);
-                database = mongoClient.getDatabase(databaseName)
-                                      .withReadPreference(readPreference)
-                                      .withWriteConcern(writeConcern);
-
-                System.out.println("mongo client connection created with "
-                        + url);
-            }
-            catch (Exception e1) {
-                System.err
-                        .println("Could not initialize MongoDB connection pool for Loader: "
-                                + e1.toString());
-                e1.printStackTrace();
-                return;
-            }
+        readPreference = uri.getOptions().getReadPreference();
+        writeConcern = uri.getOptions().getWriteConcern();
+
+        mongoClient = new MongoClient(uri);
+        database =
+            mongoClient.getDatabase(databaseName)
+                .withReadPreference(readPreference)
+                .withWriteConcern(writeConcern);
+
+        System.out.println("mongo client connection created with " + url);
+      } catch (Exception e1) {
+        System.err
+            .println("Could not initialize MongoDB connection pool for Loader: "
+                + e1.toString());
+        e1.printStackTrace();
+        return;
+      }
+    }
+  }
+
+  /**
+   * Insert a record in the database. Any field/value pairs in the specified
+   * values HashMap will be written into the record with the specified record
+   * key.
+   * 
+   * @param table
+   *          The name of the table
+   * @param key
+   *          The record key of the record to insert.
+   * @param values
+   *          A HashMap of field/value pairs to insert in the record
+   * @return Zero on success, a non-zero error code on error. See the {@link DB}
+   *         class's description for a discussion of error codes.
+   */
+  @Override
+  public int insert(String table, String key,
+      HashMap<String, ByteIterator> values) {
+    try {
+      MongoCollection<Document> collection = database.getCollection(table);
+      Document toInsert = new Document("_id", key);
+      for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
+        toInsert.put(entry.getKey(), entry.getValue().toArray());
+      }
+
+      if (batchSize == 1) {
+        // this is effectively an insert, but using an upsert instead due
+        // to current inability of the framework to clean up after itself
+        // between test runs.
+        collection.replaceOne(new Document("_id", toInsert.get("_id")),
+            toInsert, UPDATE_WITH_UPSERT);
+      } else {
+        bulkInserts.add(toInsert);
+        if (bulkInserts.size() == batchSize) {
+          collection.insertMany(bulkInserts, INSERT_UNORDERED);
+          bulkInserts.clear();
         }
+      }
+      return 0;
+    } catch (Exception e) {
+      System.err.println("Exception while trying bulk insert with "
+          + bulkInserts.size());
+      e.printStackTrace();
+      return 1;
     }
 
-    /**
-     * Insert a record in the database. Any field/value pairs in the specified
-     * values HashMap will be written into the record with the specified record
-     * key.
-     * 
-     * @param table
-     *            The name of the table
-     * @param key
-     *            The record key of the record to insert.
-     * @param values
-     *            A HashMap of field/value pairs to insert in the record
-     * @return Zero on success, a non-zero error code on error. See the
-     *         {@link DB} class's description for a discussion of error codes.
-     */
-    @Override
-    public int insert(String table, String key,
-            HashMap<String, ByteIterator> values) {
-        try {
-            MongoCollection<Document> collection = database
-                    .getCollection(table);
-            Document toInsert = new Document("_id", key);
-            for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
-                toInsert.put(entry.getKey(), entry.getValue().toArray());
-            }
-
-            if (batchSize == 1) {
-                // this is effectively an insert, but using an upsert instead due
-                // to current inability of the framework to clean up after itself
-                // between test runs.
-                collection.replaceOne(new Document("_id", toInsert.get("_id")),
-                                      toInsert,
-                                      UPDATE_WITH_UPSERT);
-            }
-            else {
-                bulkInserts.add(toInsert);
-                if (bulkInserts.size() == batchSize) {
-                    collection.insertMany(bulkInserts, INSERT_UNORDERED);
-                    bulkInserts.clear();
-                }
-            }
-            return 0;
+  }
+
+  /**
+   * Read a record from the database. Each field/value pair from the result will
+   * be stored in a HashMap.
+   * 
+   * @param table
+   *          The name of the table
+   * @param key
+   *          The record key of the record to read.
+   * @param fields
+   *          The list of fields to read, or null for all of them
+   * @param result
+   *          A HashMap of field/value pairs for the result
+   * @return Zero on success, a non-zero error code on error or "not found".
+   */
+  @Override
+  public int read(String table, String key, Set<String> fields,
+      HashMap<String, ByteIterator> result) {
+    try {
+      MongoCollection<Document> collection = database.getCollection(table);
+      Document query = new Document("_id", key);
+
+      FindIterable<Document> findIterable = collection.find(query);
+
+      if (fields != null) {
+        Document projection = new Document();
+        for (String field : fields) {
+          projection.put(field, INCLUDE);
         }
-        catch (Exception e) {
-            System.err.println("Exception while trying bulk insert with "
-                               + bulkInserts.size());
-            e.printStackTrace();
-            return 1;
+        findIterable.projection(projection);
+      }
+
+      Document queryResult = findIterable.first();
+
+      if (queryResult != null) {
+        fillMap(result, queryResult);
+      }
+      return queryResult != null ? 0 : 1;
+    } catch (Exception e) {
+      System.err.println(e.toString());
+      return 1;
+    }
+  }
+
+  /**
+   * Perform a range scan for a set of records in the database. Each field/value
+   * pair from the result will be stored in a HashMap.
+   * 
+   * @param table
+   *          The name of the table
+   * @param startkey
+   *          The record key of the first record to read.
+   * @param recordcount
+   *          The number of records to read
+   * @param fields
+   *          The list of fields to read, or null for all of them
+   * @param result
+   *          A Vector of HashMaps, where each HashMap is a set field/value
+   *          pairs for one record
+   * @return Zero on success, a non-zero error code on error. See the {@link DB}
+   *         class's description for a discussion of error codes.
+   */
+  @Override
+  public int scan(String table, String startkey, int recordcount,
+      Set<String> fields, Vector<HashMap<String, ByteIterator>> result) {
+    MongoCursor<Document> cursor = null;
+    try {
+      MongoCollection<Document> collection = database.getCollection(table);
+
+      Document scanRange = new Document("$gte", startkey);
+      Document query = new Document("_id", scanRange);
+      Document sort = new Document("_id", INCLUDE);
+
+      FindIterable<Document> findIterable =
+          collection.find(query).sort(sort).limit(recordcount);
+
+      if (fields != null) {
+        Document projection = new Document();
+        for (String fieldName : fields) {
+          projection.put(fieldName, INCLUDE);
         }
+        findIterable.projection(projection);
+      }
 
-    }
+      cursor = findIterable.iterator();
 
-    /**
-     * Read a record from the database. Each field/value pair from the result
-     * will be stored in a HashMap.
-     * 
-     * @param table
-     *            The name of the table
-     * @param key
-     *            The record key of the record to read.
-     * @param fields
-     *            The list of fields to read, or null for all of them
-     * @param result
-     *            A HashMap of field/value pairs for the result
-     * @return Zero on success, a non-zero error code on error or "not found".
-     */
-    @Override
-    public int read(String table, String key, Set<String> fields,
-            HashMap<String, ByteIterator> result) {
-        try {
-            MongoCollection<Document> collection = database
-                    .getCollection(table);
-            Document query = new Document("_id", key);
-
-            FindIterable<Document> findIterable = collection.find(query);
-
-            if (fields != null) {
-                Document projection = new Document();
-                for (String field : fields) {
-                    projection.put(field, INCLUDE);
-                }
-                findIterable.projection(projection);
-            }
-
-            Document queryResult = findIterable.first();
-
-            if (queryResult != null) {
-                fillMap(result, queryResult);
-            }
-            return queryResult != null ? 0 : 1;
-        }
-        catch (Exception e) {
-            System.err.println(e.toString());
-            return 1;
-        }
-    }
+      if (!cursor.hasNext()) {
+        System.err.println("Nothing found in scan for key " + startkey);
+        return 1;
+      }
 
-    /**
-     * Perform a range scan for a set of records in the database. Each
-     * field/value pair from the result will be stored in a HashMap.
-     * 
-     * @param table
-     *            The name of the table
-     * @param startkey
-     *            The record key of the first record to read.
-     * @param recordcount
-     *            The number of records to read
-     * @param fields
-     *            The list of fields to read, or null for all of them
-     * @param result
-     *            A Vector of HashMaps, where each HashMap is a set field/value
-     *            pairs for one record
-     * @return Zero on success, a non-zero error code on error. See the
-     *         {@link DB} class's description for a discussion of error codes.
-     */
-    @Override
-    public int scan(String table, String startkey, int recordcount,
-            Set<String> fields, Vector<HashMap<String, ByteIterator>> result) {
-        MongoCursor<Document> cursor = null;
-        try {
-            MongoCollection<Document> collection = database
-                    .getCollection(table);
-
-            Document scanRange = new Document("$gte", startkey);
-            Document query = new Document("_id", scanRange);
-            Document sort = new Document("_id", INCLUDE);
-
-            FindIterable<Document> findIterable = collection.find(query)
-                                                            .sort(sort)
-                                                            .limit(recordcount);
-
-            if (fields != null) {
-                Document projection = new Document();
-                for (String fieldName : fields) {
-                    projection.put(fieldName, INCLUDE);
-                }
-                findIterable.projection(projection);
-            }
-
-            cursor = findIterable.iterator();
-
-            if (!cursor.hasNext()) {
-                System.err.println("Nothing found in scan for key " + startkey);
-                return 1;
-            }
-
-            result.ensureCapacity(recordcount);
-
-            while (cursor.hasNext()) {
-                HashMap<String, ByteIterator> resultMap = new HashMap<String, ByteIterator>();
-
-                Document obj = cursor.next();
-                fillMap(resultMap, obj);
-
-                result.add(resultMap);
-            }
-
-            return 0;
-        }
-        catch (Exception e) {
-            System.err.println(e.toString());
-            return 1;
-        }
-        finally {
-            if (cursor != null) {
-                cursor.close();
-            }
-        }
-    }
+      result.ensureCapacity(recordcount);
 
-    /**
-     * Update a record in the database. Any field/value pairs in the specified
-     * values HashMap will be written into the record with the specified record
-     * key, overwriting any existing values with the same field name.
-     * 
-     * @param table
-     *            The name of the table
-     * @param key
-     *            The record key of the record to write.
-     * @param values
-     *            A HashMap of field/value pairs to update in the record
-     * @return Zero on success, a non-zero error code on error. See this class's
-     *         description for a discussion of error codes.
-     */
-    @Override
-    public int update(String table, String key,
-            HashMap<String, ByteIterator> values) {
-        try {
-            MongoCollection<Document> collection = database
-                    .getCollection(table);
-
-            Document query = new Document("_id", key);
-            Document fieldsToSet = new Document();
-            for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
-                fieldsToSet.put(entry.getKey(), entry.getValue().toArray());
-            }
-            Document update = new Document("$set", fieldsToSet);
-
-            UpdateResult result = collection.updateOne(query, update);
-            if (result.wasAcknowledged() && result.getMatchedCount() == 0) {
-                System.err.println("Nothing updated for key " + key);
-                return 1;
-            }
-            return 0;
-        }
-        catch (Exception e) {
-            System.err.println(e.toString());
-            return 1;
-        }
-    }
+      while (cursor.hasNext()) {
+        HashMap<String, ByteIterator> resultMap =
+            new HashMap<String, ByteIterator>();
 
-    /**
-     * Fills the map with the values from the DBObject.
-     * 
-     * @param resultMap
-     *            The map to fill/
-     * @param obj
-     *            The object to copy values from.
-     */
-    protected void fillMap(HashMap<String, ByteIterator> resultMap, Document obj) {
-        for (Map.Entry<String, Object> entry : obj.entrySet()) {
-            if (entry.getValue() instanceof Binary) {
-                resultMap.put(entry.getKey(), new ByteArrayByteIterator(
-                        ((Binary) entry.getValue()).getData()));
-            }
-        }
+        Document obj = cursor.next();
+        fillMap(resultMap, obj);
+
+        result.add(resultMap);
+      }
+
+      return 0;
+    } catch (Exception e) {
+      System.err.println(e.toString());
+      return 1;
+    } finally {
+      if (cursor != null) {
+        cursor.close();
+      }
+    }
+  }
+
+  /**
+   * Update a record in the database. Any field/value pairs in the specified
+   * values HashMap will be written into the record with the specified record
+   * key, overwriting any existing values with the same field name.
+   * 
+   * @param table
+   *          The name of the table
+   * @param key
+   *          The record key of the record to write.
+   * @param values
+   *          A HashMap of field/value pairs to update in the record
+   * @return Zero on success, a non-zero error code on error. See this class's
+   *         description for a discussion of error codes.
+   */
+  @Override
+  public int update(String table, String key,
+      HashMap<String, ByteIterator> values) {
+    try {
+      MongoCollection<Document> collection = database.getCollection(table);
+
+      Document query = new Document("_id", key);
+      Document fieldsToSet = new Document();
+      for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
+        fieldsToSet.put(entry.getKey(), entry.getValue().toArray());
+      }
+      Document update = new Document("$set", fieldsToSet);
+
+      UpdateResult result = collection.updateOne(query, update);
+      if (result.wasAcknowledged() && result.getMatchedCount() == 0) {
+        System.err.println("Nothing updated for key " + key);
+        return 1;
+      }
+      return 0;
+    } catch (Exception e) {
+      System.err.println(e.toString());
+      return 1;
+    }
+  }
+
+  /**
+   * Fills the map with the values from the DBObject.
+   * 
+   * @param resultMap
+   *          The map to fill/
+   * @param obj
+   *          The object to copy values from.
+   */
+  protected void fillMap(Map<String, ByteIterator> resultMap, Document obj) {
+    for (Map.Entry<String, Object> entry : obj.entrySet()) {
+      if (entry.getValue() instanceof Binary) {
+        resultMap.put(entry.getKey(),
+            new ByteArrayByteIterator(((Binary) entry.getValue()).getData()));
+      }
     }
+  }
 }
diff --git a/mongodb/src/main/java/com/yahoo/ycsb/db/OptionsSupport.java b/mongodb/src/main/java/com/yahoo/ycsb/db/OptionsSupport.java
index 4b1429609512627ae9b465ebeafcc41a40b87f3f..62092a0d10a51e4384156235f4a59504585ea853 100644
--- a/mongodb/src/main/java/com/yahoo/ycsb/db/OptionsSupport.java
+++ b/mongodb/src/main/java/com/yahoo/ycsb/db/OptionsSupport.java
@@ -1,149 +1,145 @@
 /*
- * #%L
- * OptionsSupport.java - mongodb-binding - Yahoo!, Inc.
- * %%
- * Copyright (C) 2015 Yahoo!, Inc.
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you
+ * may not use this file except in compliance with the License. You
+ * may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License. See accompanying
+ * LICENSE file.
  */
-
 package com.yahoo.ycsb.db;
 
 import java.util.Properties;
 
 /**
  * OptionsSupport provides methods for handling legacy options.
- * 
+ *
  * @author rjm
  */
 public final class OptionsSupport {
 
-    /** Value for an unavailable property. */
-    private static final String UNAVAILABLE = "n/a";
-
-    /**
-     * Updates the URL with the appropriate attributes if legacy properties are
-     * set and the URL does not have the property already set.
-     * 
-     * @param url
-     *            The URL to update.
-     * @param props
-     *            The legacy properties.
-     * @return The updated URL.
-     */
-    public static String updateUrl(String url, Properties props) {
-        String result = url;
+  /** Value for an unavailable property. */
+  private static final String UNAVAILABLE = "n/a";
 
-        // max connections.
-        final String maxConnections = props.getProperty(
-                "mongodb.maxconnections", UNAVAILABLE).toLowerCase();
-        if (!UNAVAILABLE.equals(maxConnections)) {
-            result = addUrlOption(result, "maxPoolSize", maxConnections);
-        }
+  /**
+   * Updates the URL with the appropriate attributes if legacy properties are
+   * set and the URL does not have the property already set.
+   *
+   * @param url
+   *          The URL to update.
+   * @param props
+   *          The legacy properties.
+   * @return The updated URL.
+   */
+  public static String updateUrl(String url, Properties props) {
+    String result = url;
 
-        // Blocked thread multiplier.
-        final String threadsAllowedToBlockForConnectionMultiplier = props
-                .getProperty(
-                        "mongodb.threadsAllowedToBlockForConnectionMultiplier",
-                        UNAVAILABLE).toLowerCase();
-        if (!UNAVAILABLE.equals(threadsAllowedToBlockForConnectionMultiplier)) {
-            result = addUrlOption(result, "waitQueueMultiple",
-                    threadsAllowedToBlockForConnectionMultiplier);
-        }
+    // max connections.
+    final String maxConnections =
+        props.getProperty("mongodb.maxconnections", UNAVAILABLE).toLowerCase();
+    if (!UNAVAILABLE.equals(maxConnections)) {
+      result = addUrlOption(result, "maxPoolSize", maxConnections);
+    }
 
-        // write concern
-        String writeConcernType = props.getProperty("mongodb.writeConcern",
+    // Blocked thread multiplier.
+    final String threadsAllowedToBlockForConnectionMultiplier =
+        props
+            .getProperty(
+                "mongodb.threadsAllowedToBlockForConnectionMultiplier",
                 UNAVAILABLE).toLowerCase();
-        if (!UNAVAILABLE.equals(writeConcernType)) {
-            if ("errors_ignored".equals(writeConcernType)) {
-                result = addUrlOption(result, "w", "0");
-            }
-            else if ("unacknowledged".equals(writeConcernType)) {
-                result = addUrlOption(result, "w", "0");
-            }
-            else if ("acknowledged".equals(writeConcernType)) {
-                result = addUrlOption(result, "w", "1");
-            }
-            else if ("journaled".equals(writeConcernType)) {
-                result = addUrlOption(result, "journal", "true"); // this is the documented option name
-                result = addUrlOption(result, "j", "true");       // but keep this until MongoDB Java driver supports "journal" option
-            }
-            else if ("replica_acknowledged".equals(writeConcernType)) {
-                result = addUrlOption(result, "w", "2");
-            }
-            else if ("majority".equals(writeConcernType)) {
-                result = addUrlOption(result, "w", "majority");
-            }
-            else {
-                System.err.println("WARNING: Invalid writeConcern: '"
-                        + writeConcernType + "' will be ignored. "
-                        + "Must be one of [ unacknowledged | acknowledged | "
-                        + "journaled | replica_acknowledged | majority ]");
-            }
-        }
+    if (!UNAVAILABLE.equals(threadsAllowedToBlockForConnectionMultiplier)) {
+      result =
+          addUrlOption(result, "waitQueueMultiple",
+              threadsAllowedToBlockForConnectionMultiplier);
+    }
 
-        // read preference
-        String readPreferenceType = props.getProperty("mongodb.readPreference",
-                UNAVAILABLE).toLowerCase();
-        if (!UNAVAILABLE.equals(readPreferenceType)) {
-            if ("primary".equals(readPreferenceType)) {
-                result = addUrlOption(result, "readPreference", "primary");
-            }
-            else if ("primary_preferred".equals(readPreferenceType)) {
-                result = addUrlOption(result, "readPreference",
-                        "primaryPreferred");
-            }
-            else if ("secondary".equals(readPreferenceType)) {
-                result = addUrlOption(result, "readPreference", "secondary");
-            }
-            else if ("secondary_preferred".equals(readPreferenceType)) {
-                result = addUrlOption(result, "readPreference",
-                        "secondaryPreferred");
-            }
-            else if ("nearest".equals(readPreferenceType)) {
-                result = addUrlOption(result, "readPreference", "nearest");
-            }
-            else {
-                System.err.println("WARNING: Invalid readPreference: '"
-                        + readPreferenceType + "' will be ignored. "
-                        + "Must be one of [ primary | primary_preferred | "
-                        + "secondary | secondary_preferred | nearest ]");
-            }
-        }
+    // write concern
+    String writeConcernType =
+        props.getProperty("mongodb.writeConcern", UNAVAILABLE).toLowerCase();
+    if (!UNAVAILABLE.equals(writeConcernType)) {
+      if ("errors_ignored".equals(writeConcernType)) {
+        result = addUrlOption(result, "w", "0");
+      } else if ("unacknowledged".equals(writeConcernType)) {
+        result = addUrlOption(result, "w", "0");
+      } else if ("acknowledged".equals(writeConcernType)) {
+        result = addUrlOption(result, "w", "1");
+      } else if ("journaled".equals(writeConcernType)) {
+        result = addUrlOption(result, "journal", "true"); // this is the
+        // documented option
+        // name
+        result = addUrlOption(result, "j", "true"); // but keep this until
+        // MongoDB Java driver
+        // supports "journal" option
+      } else if ("replica_acknowledged".equals(writeConcernType)) {
+        result = addUrlOption(result, "w", "2");
+      } else if ("majority".equals(writeConcernType)) {
+        result = addUrlOption(result, "w", "majority");
+      } else {
+        System.err.println("WARNING: Invalid writeConcern: '"
+            + writeConcernType + "' will be ignored. "
+            + "Must be one of [ unacknowledged | acknowledged | "
+            + "journaled | replica_acknowledged | majority ]");
+      }
+    }
 
-        return result;
+    // read preference
+    String readPreferenceType =
+        props.getProperty("mongodb.readPreference", UNAVAILABLE).toLowerCase();
+    if (!UNAVAILABLE.equals(readPreferenceType)) {
+      if ("primary".equals(readPreferenceType)) {
+        result = addUrlOption(result, "readPreference", "primary");
+      } else if ("primary_preferred".equals(readPreferenceType)) {
+        result = addUrlOption(result, "readPreference", "primaryPreferred");
+      } else if ("secondary".equals(readPreferenceType)) {
+        result = addUrlOption(result, "readPreference", "secondary");
+      } else if ("secondary_preferred".equals(readPreferenceType)) {
+        result = addUrlOption(result, "readPreference", "secondaryPreferred");
+      } else if ("nearest".equals(readPreferenceType)) {
+        result = addUrlOption(result, "readPreference", "nearest");
+      } else {
+        System.err.println("WARNING: Invalid readPreference: '"
+            + readPreferenceType + "' will be ignored. "
+            + "Must be one of [ primary | primary_preferred | "
+            + "secondary | secondary_preferred | nearest ]");
+      }
     }
 
-    /**
-     * Adds an option to the url if it does not already contain the option.
-     * 
-     * @param url
-     *            The URL to append the options to.
-     * @param name
-     *            The name of the option.
-     * @param value
-     *            The value for the option.
-     * @return The updated URL.
-     */
-    private static String addUrlOption(String url, String name, String value) {
-        String fullName = name + "=";
-        if (!url.contains(fullName)) {
-            if (url.contains("?")) {
-                return url + "&" + fullName + value;
-            }
-            return url + "?" + fullName + value;
-        }
-        return url;
+    return result;
+  }
+
+  /**
+   * Adds an option to the url if it does not already contain the option.
+   *
+   * @param url
+   *          The URL to append the options to.
+   * @param name
+   *          The name of the option.
+   * @param value
+   *          The value for the option.
+   * @return The updated URL.
+   */
+  private static String addUrlOption(String url, String name, String value) {
+    String fullName = name + "=";
+    if (!url.contains(fullName)) {
+      if (url.contains("?")) {
+        return url + "&" + fullName + value;
+      }
+      return url + "?" + fullName + value;
     }
+    return url;
+  }
+
+  /**
+   * Hidden Constructor.
+   */
+  private OptionsSupport() {
+    // Nothing.
+  }
 }
diff --git a/mongodb/src/main/java/com/yahoo/ycsb/db/package-info.java b/mongodb/src/main/java/com/yahoo/ycsb/db/package-info.java
new file mode 100644
index 0000000000000000000000000000000000000000..6c64e3fa7434b191b5bc4374cb0c763fc633e769
--- /dev/null
+++ b/mongodb/src/main/java/com/yahoo/ycsb/db/package-info.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you
+ * may not use this file except in compliance with the License. You
+ * may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License. See accompanying
+ * LICENSE file.
+ */
+
+/**
+ * The YCSB binding for <a href="https://www.mongodb.org/">MongoDB</a>.
+ * For additional details on using and configuring the binding see the 
+ * accompanying <a 
+ * href="https://github.com/brianfrankcooper/YCSB/blob/master/mongodb/README.md"
+ * >README.md</a>.
+ * <p>
+ * A YCSB binding is provided for both the the
+ * <a href="http://www.allanbank.com/mongodb-async-driver/">Asynchronous
+ * Java Driver</a> and the MongoDB Inc.
+ * <a href="http://docs.mongodb.org/ecosystem/drivers/java/">driver</a>.
+ * </p>
+ */
+package com.yahoo.ycsb.db;
+
diff --git a/mongodb/src/test/java/com/yahoo/ycsb/db/AbstractDBTestCases.java b/mongodb/src/test/java/com/yahoo/ycsb/db/AbstractDBTestCases.java
index 79340e8016f11ab4ee6bb13368d207cd4eeb7b01..a2ced3f543b0d91797e63dfffc7a1989b689a65e 100644
--- a/mongodb/src/test/java/com/yahoo/ycsb/db/AbstractDBTestCases.java
+++ b/mongodb/src/test/java/com/yahoo/ycsb/db/AbstractDBTestCases.java
@@ -1,18 +1,18 @@
-/*                                                                                                                                                                                
- * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.                                                                                                                             
- *                                                                                                                                                                                 
- * Licensed under the Apache License, Version 2.0 (the "License"); you                                                                                                             
- * may not use this file except in compliance with the License. You                                                                                                                
- * may obtain a copy of the License at                                                                                                                                             
- *                                                                                                                                                                                 
- * http://www.apache.org/licenses/LICENSE-2.0                                                                                                                                      
- *                                                                                                                                                                                 
- * Unless required by applicable law or agreed to in writing, software                                                                                                             
- * distributed under the License is distributed on an "AS IS" BASIS,                                                                                                               
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or                                                                                                                 
- * implied. See the License for the specific language governing                                                                                                                    
- * permissions and limitations under the License. See accompanying                                                                                                                 
- * LICENSE file.                                                                                                                                                                   
+/*
+ * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you
+ * may not use this file except in compliance with the License. You
+ * may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License. See accompanying
+ * LICENSE file.
  */
 package com.yahoo.ycsb.db;
 
@@ -49,219 +49,215 @@ import com.yahoo.ycsb.DB;
 @SuppressWarnings("boxing")
 public abstract class AbstractDBTestCases {
 
-    /** The default port for MongoDB. */
-    private static final int MONGODB_DEFAULT_PORT = 27017;
+  /** The default port for MongoDB. */
+  private static final int MONGODB_DEFAULT_PORT = 27017;
 
-    /**
-     * Verifies the mongod process (or some process) is running on port 27017,
-     * if not the tests are skipped.
-     */
-    @BeforeClass
-    public static void setUpBeforeClass() {
-        // Test if we can connect.
-        Socket socket = null;
+  /**
+   * Verifies the mongod process (or some process) is running on port 27017, if
+   * not the tests are skipped.
+   */
+  @BeforeClass
+  public static void setUpBeforeClass() {
+    // Test if we can connect.
+    Socket socket = null;
+    try {
+      // Connect
+      socket = new Socket(InetAddress.getLocalHost(), MONGODB_DEFAULT_PORT);
+      assertThat("Socket is not bound.", socket.getLocalPort(), not(-1));
+    } catch (IOException connectFailed) {
+      assumeNoException("MongoDB is not running. Skipping tests.",
+          connectFailed);
+    } finally {
+      if (socket != null) {
         try {
-            // Connect
-            socket = new Socket(InetAddress.getLocalHost(),
-                    MONGODB_DEFAULT_PORT);
-            assertThat("Socket is not bound.", socket.getLocalPort(), not(-1));
-        }
-        catch (IOException connectFailed) {
-            assumeNoException("MongoDB is not running. Skipping tests.",
-                    connectFailed);
-        }
-        finally {
-            if (socket != null) {
-                try {
-                    socket.close();
-                }
-                catch (IOException ignore) {
-                    // Ignore.
-                }
-            }
-            socket = null;
+          socket.close();
+        } catch (IOException ignore) {
+          // Ignore.
         }
+      }
+      socket = null;
     }
+  }
 
-    /**
-     * Test method for {@link DB#insert}, {@link DB#read}, and {@link DB#delete}
-     * .
-     */
-    @Test
-    public void testInsertReadDelete() {
-        final DB client = getDB();
+  /**
+   * Test method for {@link DB#insert}, {@link DB#read}, and {@link DB#delete} .
+   */
+  @Test
+  public void testInsertReadDelete() {
+    final DB client = getDB();
 
-        final String table = "test";
-        final String id = "delete";
+    final String table = getClass().getSimpleName();
+    final String id = "delete";
 
-        HashMap<String, ByteIterator> inserted = new HashMap<String, ByteIterator>();
-        inserted.put("a", new ByteArrayByteIterator(new byte[] { 1, 2, 3, 4 }));
-        int result = client.insert(table, id, inserted);
-        assertThat("Insert did not return success (0).", result, is(0));
+    HashMap<String, ByteIterator> inserted =
+        new HashMap<String, ByteIterator>();
+    inserted.put("a", new ByteArrayByteIterator(new byte[] { 1, 2, 3, 4 }));
+    int result = client.insert(table, id, inserted);
+    assertThat("Insert did not return success (0).", result, is(0));
 
-        HashMap<String, ByteIterator> read = new HashMap<String, ByteIterator>();
-        Set<String> keys = Collections.singleton("a");
-        result = client.read(table, id, keys, read);
-        assertThat("Read did not return success (0).", result, is(0));
-        for (String key : keys) {
-            ByteIterator iter = read.get(key);
+    HashMap<String, ByteIterator> read = new HashMap<String, ByteIterator>();
+    Set<String> keys = Collections.singleton("a");
+    result = client.read(table, id, keys, read);
+    assertThat("Read did not return success (0).", result, is(0));
+    for (String key : keys) {
+      ByteIterator iter = read.get(key);
 
-            assertThat("Did not read the inserted field: " + key, iter,
-                    notNullValue());
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 1)));
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 2)));
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 3)));
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 4)));
-            assertFalse(iter.hasNext());
-        }
+      assertThat("Did not read the inserted field: " + key, iter,
+          notNullValue());
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 1)));
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 2)));
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 3)));
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 4)));
+      assertFalse(iter.hasNext());
+    }
 
-        result = client.delete(table, id);
-        assertThat("Delete did not return success (0).", result, is(0));
+    result = client.delete(table, id);
+    assertThat("Delete did not return success (0).", result, is(0));
 
-        read.clear();
-        result = client.read(table, id, null, read);
-        assertThat("Read, after delete, did not return not found (1).", result,
-                is(1));
-        assertThat("Found the deleted fields.", read.size(), is(0));
+    read.clear();
+    result = client.read(table, id, null, read);
+    assertThat("Read, after delete, did not return not found (1).", result,
+        is(1));
+    assertThat("Found the deleted fields.", read.size(), is(0));
 
-        result = client.delete(table, id);
-        assertThat("Delete did not return not found (1).", result, is(1));
-    }
+    result = client.delete(table, id);
+    assertThat("Delete did not return not found (1).", result, is(1));
+  }
 
-    /**
-     * Test method for {@link DB#insert}, {@link DB#read}, and {@link DB#update}
-     * .
-     */
-    @Test
-    public void testInsertReadUpdate() {
-        DB client = getDB();
+  /**
+   * Test method for {@link DB#insert}, {@link DB#read}, and {@link DB#update} .
+   */
+  @Test
+  public void testInsertReadUpdate() {
+    DB client = getDB();
 
-        final String table = "test";
-        final String id = "update";
+    final String table = getClass().getSimpleName();
+    final String id = "update";
 
-        HashMap<String, ByteIterator> inserted = new HashMap<String, ByteIterator>();
-        inserted.put("a", new ByteArrayByteIterator(new byte[] { 1, 2, 3, 4 }));
-        int result = client.insert(table, id, inserted);
-        assertThat("Insert did not return success (0).", result, is(0));
+    HashMap<String, ByteIterator> inserted =
+        new HashMap<String, ByteIterator>();
+    inserted.put("a", new ByteArrayByteIterator(new byte[] { 1, 2, 3, 4 }));
+    int result = client.insert(table, id, inserted);
+    assertThat("Insert did not return success (0).", result, is(0));
 
-        HashMap<String, ByteIterator> read = new HashMap<String, ByteIterator>();
-        Set<String> keys = Collections.singleton("a");
-        result = client.read(table, id, keys, read);
-        assertThat("Read did not return success (0).", result, is(0));
-        for (String key : keys) {
-            ByteIterator iter = read.get(key);
+    HashMap<String, ByteIterator> read = new HashMap<String, ByteIterator>();
+    Set<String> keys = Collections.singleton("a");
+    result = client.read(table, id, keys, read);
+    assertThat("Read did not return success (0).", result, is(0));
+    for (String key : keys) {
+      ByteIterator iter = read.get(key);
 
-            assertThat("Did not read the inserted field: " + key, iter,
-                    notNullValue());
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 1)));
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 2)));
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 3)));
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 4)));
-            assertFalse(iter.hasNext());
-        }
+      assertThat("Did not read the inserted field: " + key, iter,
+          notNullValue());
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 1)));
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 2)));
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 3)));
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 4)));
+      assertFalse(iter.hasNext());
+    }
 
-        HashMap<String, ByteIterator> updated = new HashMap<String, ByteIterator>();
-        updated.put("a", new ByteArrayByteIterator(new byte[] { 5, 6, 7, 8 }));
-        result = client.update(table, id, updated);
-        assertThat("Update did not return success (0).", result, is(0));
+    HashMap<String, ByteIterator> updated = new HashMap<String, ByteIterator>();
+    updated.put("a", new ByteArrayByteIterator(new byte[] { 5, 6, 7, 8 }));
+    result = client.update(table, id, updated);
+    assertThat("Update did not return success (0).", result, is(0));
 
-        read.clear();
-        result = client.read(table, id, null, read);
-        assertThat("Read, after update, did not return success (0).", result,
-                is(0));
-        for (String key : keys) {
-            ByteIterator iter = read.get(key);
+    read.clear();
+    result = client.read(table, id, null, read);
+    assertThat("Read, after update, did not return success (0).", result, is(0));
+    for (String key : keys) {
+      ByteIterator iter = read.get(key);
 
-            assertThat("Did not read the inserted field: " + key, iter,
-                    notNullValue());
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 5)));
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 6)));
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 7)));
-            assertTrue(iter.hasNext());
-            assertThat(iter.nextByte(), is(Byte.valueOf((byte) 8)));
-            assertFalse(iter.hasNext());
-        }
+      assertThat("Did not read the inserted field: " + key, iter,
+          notNullValue());
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 5)));
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 6)));
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 7)));
+      assertTrue(iter.hasNext());
+      assertThat(iter.nextByte(), is(Byte.valueOf((byte) 8)));
+      assertFalse(iter.hasNext());
     }
+  }
 
-    /**
-     * Test method for {@link DB#scan}.
-     */
-    @Test
-    public void testScan() {
-        final DB client = getDB();
+  /**
+   * Test method for {@link DB#scan}.
+   */
+  @Test
+  public void testScan() {
+    final DB client = getDB();
 
-        final String table = "test";
+    final String table = getClass().getSimpleName();
 
-        // Insert a bunch of documents.
-        for (int i = 0; i < 100; ++i) {
-            HashMap<String, ByteIterator> inserted = new HashMap<String, ByteIterator>();
-            inserted.put("a", new ByteArrayByteIterator(new byte[] {
-                    (byte) (i & 0xFF), (byte) (i >> 8 & 0xFF),
-                    (byte) (i >> 16 & 0xFF), (byte) (i >> 24 & 0xFF) }));
-            int result = client.insert(table, padded(i), inserted);
-            assertThat("Insert did not return success (0).", result, is(0));
-        }
+    // Insert a bunch of documents.
+    for (int i = 0; i < 100; ++i) {
+      HashMap<String, ByteIterator> inserted =
+          new HashMap<String, ByteIterator>();
+      inserted.put("a", new ByteArrayByteIterator(new byte[] {
+          (byte) (i & 0xFF), (byte) (i >> 8 & 0xFF), (byte) (i >> 16 & 0xFF),
+          (byte) (i >> 24 & 0xFF) }));
+      int result = client.insert(table, padded(i), inserted);
+      assertThat("Insert did not return success (0).", result, is(0));
+    }
 
-        Set<String> keys = Collections.singleton("a");
-        Vector<HashMap<String, ByteIterator>> results = new Vector<HashMap<String, ByteIterator>>();
-        int result = client.scan(table, "00050", 5, null, results);
-        assertThat("Read did not return success (0).", result, is(0));
-        assertThat(results.size(), is(5));
-        for (int i = 0; i < 5; ++i) {
-            HashMap<String, ByteIterator> read = results.get(i);
-            for (String key : keys) {
-                ByteIterator iter = read.get(key);
+    Set<String> keys = Collections.singleton("a");
+    Vector<HashMap<String, ByteIterator>> results =
+        new Vector<HashMap<String, ByteIterator>>();
+    int result = client.scan(table, "00050", 5, null, results);
+    assertThat("Read did not return success (0).", result, is(0));
+    assertThat(results.size(), is(5));
+    for (int i = 0; i < 5; ++i) {
+      HashMap<String, ByteIterator> read = results.get(i);
+      for (String key : keys) {
+        ByteIterator iter = read.get(key);
 
-                assertThat("Did not read the inserted field: " + key, iter,
-                        notNullValue());
-                assertTrue(iter.hasNext());
-                assertThat(iter.nextByte(),
-                        is(Byte.valueOf((byte) ((i + 50) & 0xFF))));
-                assertTrue(iter.hasNext());
-                assertThat(iter.nextByte(),
-                        is(Byte.valueOf((byte) ((i + 50) >> 8 & 0xFF))));
-                assertTrue(iter.hasNext());
-                assertThat(iter.nextByte(),
-                        is(Byte.valueOf((byte) ((i + 50) >> 16 & 0xFF))));
-                assertTrue(iter.hasNext());
-                assertThat(iter.nextByte(),
-                        is(Byte.valueOf((byte) ((i + 50) >> 24 & 0xFF))));
-                assertFalse(iter.hasNext());
-            }
-        }
+        assertThat("Did not read the inserted field: " + key, iter,
+            notNullValue());
+        assertTrue(iter.hasNext());
+        assertThat(iter.nextByte(), is(Byte.valueOf((byte) ((i + 50) & 0xFF))));
+        assertTrue(iter.hasNext());
+        assertThat(iter.nextByte(),
+            is(Byte.valueOf((byte) ((i + 50) >> 8 & 0xFF))));
+        assertTrue(iter.hasNext());
+        assertThat(iter.nextByte(),
+            is(Byte.valueOf((byte) ((i + 50) >> 16 & 0xFF))));
+        assertTrue(iter.hasNext());
+        assertThat(iter.nextByte(),
+            is(Byte.valueOf((byte) ((i + 50) >> 24 & 0xFF))));
+        assertFalse(iter.hasNext());
+      }
     }
+  }
 
-    /**
-     * Gets the test DB.
-     * 
-     * @return The test DB.
-     */
-    protected abstract DB getDB();
+  /**
+   * Gets the test DB.
+   * 
+   * @return The test DB.
+   */
+  protected abstract DB getDB();
 
-    /**
-     * Creates a zero padded integer.
-     * 
-     * @param i
-     *            The integer to padd.
-     * @return The padded integer.
-     */
-    private String padded(int i) {
-        String result = String.valueOf(i);
-        while (result.length() < 5) {
-            result = "0" + result;
-        }
-        return result;
+  /**
+   * Creates a zero padded integer.
+   * 
+   * @param i
+   *          The integer to padd.
+   * @return The padded integer.
+   */
+  private String padded(int i) {
+    String result = String.valueOf(i);
+    while (result.length() < 5) {
+      result = "0" + result;
     }
+    return result;
+  }
 
 }
\ No newline at end of file
diff --git a/mongodb/src/test/java/com/yahoo/ycsb/db/AsyncMongoDbClientTest.java b/mongodb/src/test/java/com/yahoo/ycsb/db/AsyncMongoDbClientTest.java
index f5ee7b658e5f0e5b6a018a9fb0cb244d3422ffcd..11b45b2db9b17e4dc8337a6a3472e900670c3e23 100644
--- a/mongodb/src/test/java/com/yahoo/ycsb/db/AsyncMongoDbClientTest.java
+++ b/mongodb/src/test/java/com/yahoo/ycsb/db/AsyncMongoDbClientTest.java
@@ -1,18 +1,18 @@
-/*                                                                                                                                                                         
- * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.                                                                                                                             
- *                                                                                                                                                                                 
- * Licensed under the Apache License, Version 2.0 (the "License"); you                                                                                                             
- * may not use this file except in compliance with the License. You                                                                                                                
- * may obtain a copy of the License at                                                                                                                                             
- *                                                                                                                                                                                 
- * http://www.apache.org/licenses/LICENSE-2.0                                                                                                                                      
- *                                                                                                                                                                                 
- * Unless required by applicable law or agreed to in writing, software                                                                                                             
- * distributed under the License is distributed on an "AS IS" BASIS,                                                                                                               
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or                                                                                                                 
- * implied. See the License for the specific language governing                                                                                                                    
- * permissions and limitations under the License. See accompanying                                                                                                                 
- * LICENSE file.                                                                                                                                                                   
+/*
+ * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you
+ * may not use this file except in compliance with the License. You
+ * may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License. See accompanying
+ * LICENSE file.
  */
 package com.yahoo.ycsb.db;
 
@@ -30,48 +30,45 @@ import com.yahoo.ycsb.DB;
  */
 public class AsyncMongoDbClientTest extends AbstractDBTestCases {
 
-    /** The client to use. */
-    private AsyncMongoDbClient myClient = null;
+  /** The client to use. */
+  private AsyncMongoDbClient myClient = null;
 
-    /**
-     * Start a test client.
-     */
-    @Before
-    public void setUp() {
-        myClient = new AsyncMongoDbClient();
-        myClient.setProperties(new Properties());
-        try {
-            myClient.init();
-        }
-        catch (Exception error) {
-            assumeNoException(error);
-        }
+  /**
+   * Start a test client.
+   */
+  @Before
+  public void setUp() {
+    myClient = new AsyncMongoDbClient();
+    myClient.setProperties(new Properties());
+    try {
+      myClient.init();
+    } catch (Exception error) {
+      assumeNoException(error);
     }
+  }
 
-    /**
-     * Stops the test client.
-     */
-    @After
-    public void tearDown() {
-        try {
-            myClient.cleanup();
-        }
-        catch (Exception error) {
-            // Ignore.
-        }
-        finally {
-            myClient = null;
-        }
+  /**
+   * Stops the test client.
+   */
+  @After
+  public void tearDown() {
+    try {
+      myClient.cleanup();
+    } catch (Exception error) {
+      // Ignore.
+    } finally {
+      myClient = null;
     }
+  }
 
-    /**
-     * {@inheritDoc}
-     * <p>
-     * Overriden to return the {@link AsyncMongoDbClient}.
-     * </p>
-     */
-    @Override
-    protected DB getDB() {
-        return myClient;
-    }
+  /**
+   * {@inheritDoc}
+   * <p>
+   * Overriden to return the {@link AsyncMongoDbClient}.
+   * </p>
+   */
+  @Override
+  protected DB getDB() {
+    return myClient;
+  }
 }
diff --git a/mongodb/src/test/java/com/yahoo/ycsb/db/MongoDbClientTest.java b/mongodb/src/test/java/com/yahoo/ycsb/db/MongoDbClientTest.java
index 515fb8026309e576c36ccba399d161505d90719d..47a926e42915d8f1a104c07474df3007212ee461 100644
--- a/mongodb/src/test/java/com/yahoo/ycsb/db/MongoDbClientTest.java
+++ b/mongodb/src/test/java/com/yahoo/ycsb/db/MongoDbClientTest.java
@@ -1,18 +1,18 @@
-/*                                                                                                                                                                         
- * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.                                                                                                                             
- *                                                                                                                                                                                 
- * Licensed under the Apache License, Version 2.0 (the "License"); you                                                                                                             
- * may not use this file except in compliance with the License. You                                                                                                                
- * may obtain a copy of the License at                                                                                                                                             
- *                                                                                                                                                                                 
- * http://www.apache.org/licenses/LICENSE-2.0                                                                                                                                      
- *                                                                                                                                                                                 
- * Unless required by applicable law or agreed to in writing, software                                                                                                             
- * distributed under the License is distributed on an "AS IS" BASIS,                                                                                                               
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or                                                                                                                 
- * implied. See the License for the specific language governing                                                                                                                    
- * permissions and limitations under the License. See accompanying                                                                                                                 
- * LICENSE file.                                                                                                                                                                   
+/*
+ * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you
+ * may not use this file except in compliance with the License. You
+ * may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License. See accompanying
+ * LICENSE file.
  */
 package com.yahoo.ycsb.db;
 
@@ -30,48 +30,45 @@ import com.yahoo.ycsb.DB;
  */
 public class MongoDbClientTest extends AbstractDBTestCases {
 
-    /** The client to use. */
-    private MongoDbClient myClient = null;
+  /** The client to use. */
+  private MongoDbClient myClient = null;
 
-    /**
-     * Start a test client.
-     */
-    @Before
-    public void setUp() {
-        myClient = new MongoDbClient();
-        myClient.setProperties(new Properties());
-        try {
-            myClient.init();
-        }
-        catch (Exception error) {
-            assumeNoException(error);
-        }
+  /**
+   * Start a test client.
+   */
+  @Before
+  public void setUp() {
+    myClient = new MongoDbClient();
+    myClient.setProperties(new Properties());
+    try {
+      myClient.init();
+    } catch (Exception error) {
+      assumeNoException(error);
     }
+  }
 
-    /**
-     * Stops the test client.
-     */
-    @After
-    public void tearDown() {
-        try {
-            myClient.cleanup();
-        }
-        catch (Exception error) {
-            // Ignore.
-        }
-        finally {
-            myClient = null;
-        }
+  /**
+   * Stops the test client.
+   */
+  @After
+  public void tearDown() {
+    try {
+      myClient.cleanup();
+    } catch (Exception error) {
+      // Ignore.
+    } finally {
+      myClient = null;
     }
+  }
 
-    /**
-     * {@inheritDoc}
-     * <p>
-     * Overriden to return the {@link MongoDbClient}.
-     * </p>
-     */
-    @Override
-    protected DB getDB() {
-        return myClient;
-    }
+  /**
+   * {@inheritDoc}
+   * <p>
+   * Overriden to return the {@link MongoDbClient}.
+   * </p>
+   */
+  @Override
+  protected DB getDB() {
+    return myClient;
+  }
 }
diff --git a/mongodb/src/test/java/com/yahoo/ycsb/db/OptionsSupportTest.java b/mongodb/src/test/java/com/yahoo/ycsb/db/OptionsSupportTest.java
index a1b9de650f9922e33c7a3b36bbf453bfaab03ee1..be7f52fe1d6a8ffbe53bdd9a743869c1eccbca60 100644
--- a/mongodb/src/test/java/com/yahoo/ycsb/db/OptionsSupportTest.java
+++ b/mongodb/src/test/java/com/yahoo/ycsb/db/OptionsSupportTest.java
@@ -1,23 +1,19 @@
 /*
- * #%L
- * OptionsSupport.java - mongodb-binding - Yahoo!, Inc.
- * %%
- * Copyright (C) 2015 Yahoo!, Inc.
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ * Copyright (c) 2014, Yahoo!, Inc. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you
+ * may not use this file except in compliance with the License. You
+ * may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License. See accompanying
+ * LICENSE file.
  */
-
 package com.yahoo.ycsb.db;
 
 import static com.yahoo.ycsb.db.OptionsSupport.updateUrl;
@@ -30,164 +26,159 @@ import org.junit.Test;
 
 /**
  * OptionsSupportTest provides tests for the OptionsSupport class.
- * 
+ *
  * @author rjm
  */
 public class OptionsSupportTest {
 
-    /**
-     * Test method for {@link OptionsSupport#updateUrl(String, Properties)} for
-     * {@code mongodb.maxconnections}.
-     */
-    @Test
-    public void testUpdateUrlMaxConnections() {
-        assertThat(
-                updateUrl("mongodb://locahost:27017/",
-                        props("mongodb.maxconnections", "1234")),
-                is("mongodb://locahost:27017/?maxPoolSize=1234"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.maxconnections", "1234")),
-                is("mongodb://locahost:27017/?foo=bar&maxPoolSize=1234"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?maxPoolSize=1",
-                        props("mongodb.maxconnections", "1234")),
-                is("mongodb://locahost:27017/?maxPoolSize=1"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("foo", "1234")),
-                is("mongodb://locahost:27017/?foo=bar"));
-    }
-
-    /**
-     * Test method for {@link OptionsSupport#updateUrl(String, Properties)} for
-     * {@code mongodb.threadsAllowedToBlockForConnectionMultiplier}.
-     */
-    @Test
-    public void testUpdateUrlWaitQueueMultiple() {
-        assertThat(
-                updateUrl(
-                        "mongodb://locahost:27017/",
-                        props("mongodb.threadsAllowedToBlockForConnectionMultiplier",
-                                "1234")),
-                is("mongodb://locahost:27017/?waitQueueMultiple=1234"));
-        assertThat(
-                updateUrl(
-                        "mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.threadsAllowedToBlockForConnectionMultiplier",
-                                "1234")),
-                is("mongodb://locahost:27017/?foo=bar&waitQueueMultiple=1234"));
-        assertThat(
-                updateUrl(
-                        "mongodb://locahost:27017/?waitQueueMultiple=1",
-                        props("mongodb.threadsAllowedToBlockForConnectionMultiplier",
-                                "1234")),
-                is("mongodb://locahost:27017/?waitQueueMultiple=1"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("foo", "1234")),
-                is("mongodb://locahost:27017/?foo=bar"));
-    }
-
-    /**
-     * Test method for {@link OptionsSupport#updateUrl(String, Properties)} for
-     * {@code mongodb.threadsAllowedToBlockForConnectionMultiplier}.
-     */
-    @Test
-    public void testUpdateUrlWriteConcern() {
-        assertThat(
-                updateUrl("mongodb://locahost:27017/",
-                        props("mongodb.writeConcern", "errors_ignored")),
-                is("mongodb://locahost:27017/?w=0"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.writeConcern", "unacknowledged")),
-                is("mongodb://locahost:27017/?foo=bar&w=0"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.writeConcern", "acknowledged")),
-                is("mongodb://locahost:27017/?foo=bar&w=1"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.writeConcern", "journaled")),
-                is("mongodb://locahost:27017/?foo=bar&journal=true&j=true"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.writeConcern", "replica_acknowledged")),
-                is("mongodb://locahost:27017/?foo=bar&w=2"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.writeConcern", "majority")),
-                is("mongodb://locahost:27017/?foo=bar&w=majority"));
-
-        // w already exists.
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?w=1",
-                        props("mongodb.writeConcern", "acknowledged")),
-                is("mongodb://locahost:27017/?w=1"));
-
-        // Unknown options
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("foo", "1234")),
-                is("mongodb://locahost:27017/?foo=bar"));
-    }
-
-    /**
-     * Test method for {@link OptionsSupport#updateUrl(String, Properties)} for
-     * {@code mongodb.threadsAllowedToBlockForConnectionMultiplier}.
-     */
-    @Test
-    public void testUpdateUrlReadPreference() {
-        assertThat(
-                updateUrl("mongodb://locahost:27017/",
-                        props("mongodb.readPreference", "primary")),
-                is("mongodb://locahost:27017/?readPreference=primary"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.readPreference", "primary_preferred")),
-                is("mongodb://locahost:27017/?foo=bar&readPreference=primaryPreferred"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.readPreference", "secondary")),
-                is("mongodb://locahost:27017/?foo=bar&readPreference=secondary"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.readPreference", "secondary_preferred")),
-                is("mongodb://locahost:27017/?foo=bar&readPreference=secondaryPreferred"));
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("mongodb.readPreference", "nearest")),
-                is("mongodb://locahost:27017/?foo=bar&readPreference=nearest"));
-
-        // readPreference already exists.
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?readPreference=primary",
-                        props("mongodb.readPreference", "secondary")),
-                is("mongodb://locahost:27017/?readPreference=primary"));
-
-        // Unknown options
-        assertThat(
-                updateUrl("mongodb://locahost:27017/?foo=bar",
-                        props("foo", "1234")),
-                is("mongodb://locahost:27017/?foo=bar"));
-    }
-
-    /**
-     * Factory method for a {@link Properties} object.
-     * 
-     * @param key
-     *            The key for the property to set.
-     * @param value
-     *            The value for the property to set.
-     * @return The {@link Properties} with the property added.
-     */
-    private Properties props(String key, String value) {
-        Properties props = new Properties();
-
-        props.setProperty(key, value);
-
-        return props;
-    }
+  /**
+   * Test method for {@link OptionsSupport#updateUrl(String, Properties)} for
+   * {@code mongodb.maxconnections}.
+   */
+  @Test
+  public void testUpdateUrlMaxConnections() {
+    assertThat(
+        updateUrl("mongodb://locahost:27017/",
+            props("mongodb.maxconnections", "1234")),
+        is("mongodb://locahost:27017/?maxPoolSize=1234"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar",
+            props("mongodb.maxconnections", "1234")),
+        is("mongodb://locahost:27017/?foo=bar&maxPoolSize=1234"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?maxPoolSize=1",
+            props("mongodb.maxconnections", "1234")),
+        is("mongodb://locahost:27017/?maxPoolSize=1"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar", props("foo", "1234")),
+        is("mongodb://locahost:27017/?foo=bar"));
+  }
+
+  /**
+   * Test method for {@link OptionsSupport#updateUrl(String, Properties)} for
+   * {@code mongodb.threadsAllowedToBlockForConnectionMultiplier}.
+   */
+  @Test
+  public void testUpdateUrlWaitQueueMultiple() {
+    assertThat(
+        updateUrl(
+            "mongodb://locahost:27017/",
+            props("mongodb.threadsAllowedToBlockForConnectionMultiplier",
+                "1234")),
+        is("mongodb://locahost:27017/?waitQueueMultiple=1234"));
+    assertThat(
+        updateUrl(
+            "mongodb://locahost:27017/?foo=bar",
+            props("mongodb.threadsAllowedToBlockForConnectionMultiplier",
+                "1234")),
+        is("mongodb://locahost:27017/?foo=bar&waitQueueMultiple=1234"));
+    assertThat(
+        updateUrl(
+            "mongodb://locahost:27017/?waitQueueMultiple=1",
+            props("mongodb.threadsAllowedToBlockForConnectionMultiplier",
+                "1234")), is("mongodb://locahost:27017/?waitQueueMultiple=1"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar", props("foo", "1234")),
+        is("mongodb://locahost:27017/?foo=bar"));
+  }
+
+  /**
+   * Test method for {@link OptionsSupport#updateUrl(String, Properties)} for
+   * {@code mongodb.threadsAllowedToBlockForConnectionMultiplier}.
+   */
+  @Test
+  public void testUpdateUrlWriteConcern() {
+    assertThat(
+        updateUrl("mongodb://locahost:27017/",
+            props("mongodb.writeConcern", "errors_ignored")),
+        is("mongodb://locahost:27017/?w=0"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar",
+            props("mongodb.writeConcern", "unacknowledged")),
+        is("mongodb://locahost:27017/?foo=bar&w=0"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar",
+            props("mongodb.writeConcern", "acknowledged")),
+        is("mongodb://locahost:27017/?foo=bar&w=1"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar",
+            props("mongodb.writeConcern", "journaled")),
+        is("mongodb://locahost:27017/?foo=bar&journal=true&j=true"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar",
+            props("mongodb.writeConcern", "replica_acknowledged")),
+        is("mongodb://locahost:27017/?foo=bar&w=2"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar",
+            props("mongodb.writeConcern", "majority")),
+        is("mongodb://locahost:27017/?foo=bar&w=majority"));
+
+    // w already exists.
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?w=1",
+            props("mongodb.writeConcern", "acknowledged")),
+        is("mongodb://locahost:27017/?w=1"));
+
+    // Unknown options
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar", props("foo", "1234")),
+        is("mongodb://locahost:27017/?foo=bar"));
+  }
+
+  /**
+   * Test method for {@link OptionsSupport#updateUrl(String, Properties)} for
+   * {@code mongodb.threadsAllowedToBlockForConnectionMultiplier}.
+   */
+  @Test
+  public void testUpdateUrlReadPreference() {
+    assertThat(
+        updateUrl("mongodb://locahost:27017/",
+            props("mongodb.readPreference", "primary")),
+        is("mongodb://locahost:27017/?readPreference=primary"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar",
+            props("mongodb.readPreference", "primary_preferred")),
+        is("mongodb://locahost:27017/?foo=bar&readPreference=primaryPreferred"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar",
+            props("mongodb.readPreference", "secondary")),
+        is("mongodb://locahost:27017/?foo=bar&readPreference=secondary"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar",
+            props("mongodb.readPreference", "secondary_preferred")),
+        is("mongodb://locahost:27017/?foo=bar&readPreference=secondaryPreferred"));
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar",
+            props("mongodb.readPreference", "nearest")),
+        is("mongodb://locahost:27017/?foo=bar&readPreference=nearest"));
+
+    // readPreference already exists.
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?readPreference=primary",
+            props("mongodb.readPreference", "secondary")),
+        is("mongodb://locahost:27017/?readPreference=primary"));
+
+    // Unknown options
+    assertThat(
+        updateUrl("mongodb://locahost:27017/?foo=bar", props("foo", "1234")),
+        is("mongodb://locahost:27017/?foo=bar"));
+  }
+
+  /**
+   * Factory method for a {@link Properties} object.
+   * 
+   * @param key
+   *          The key for the property to set.
+   * @param value
+   *          The value for the property to set.
+   * @return The {@link Properties} with the property added.
+   */
+  private Properties props(String key, String value) {
+    Properties props = new Properties();
+
+    props.setProperty(key, value);
+
+    return props;
+  }
 
 }