Skip to content
Snippets Groups Projects
Commit cd1fb357 authored by Jared Rosoff's avatar Jared Rosoff Committed by Robert J. Moore
Browse files

No need to call getError on writeResult. any errors for writeConcern level...

No need to call getError on writeResult. any errors for writeConcern level will throw exceptions and be caught in catch block
parent 7b9cf5f4
No related branches found
No related tags found
No related merge requests found
......@@ -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());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment