From cd1fb3571981cfd72d61ed8e62ce17e8f3bee359 Mon Sep 17 00:00:00 2001
From: Jared Rosoff <jsr@10gen.com>
Date: Wed, 13 Mar 2013 10:43:02 -0700
Subject: [PATCH] No need to call getError on writeResult. any errors for
 writeConcern level will throw exceptions and be caught in catch block

---
 mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

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 814eb46e..61fca0c0 100644
--- a/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java
+++ b/mongodb/src/main/java/com/yahoo/ycsb/db/MongoDbClient.java
@@ -194,7 +194,7 @@ public class MongoDbClient extends DB {
             DBCollection collection = db.getCollection(table);
             DBObject q = new BasicDBObject().append("_id", key);
             WriteResult res = collection.remove(q, writeConcern);
-            return res.getN() == 1 ? 0 : 1;
+            return 0;
         }
         catch (Exception e) {
             System.err.println(e.toString());
@@ -236,7 +236,7 @@ public class MongoDbClient extends DB {
                 r.put(entry.getKey(), entry.getValue().toArray());
             }
             WriteResult res = collection.insert(r, writeConcern);
-            return res.getError() == null ? 0 : 1;
+            return 0;
         }
         catch (Exception e) {
             e.printStackTrace();
@@ -341,7 +341,7 @@ public class MongoDbClient extends DB {
             u.put("$set", fieldsToSet);
             WriteResult res = collection.update(q, u, false, false,
                     writeConcern);
-            return res.getN() == 1 ? 0 : 1;
+            return 0;
         }
         catch (Exception e) {
             System.err.println(e.toString());
-- 
GitLab