DATAMONGO-311 - Update MongoDB driver to v 2.7.x
Still investigating write_concern compatiblity as mentioned in the ticket
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
<name>Spring Data MongoDB</name>
|
||||
|
||||
<properties>
|
||||
<mongo.version>2.6.5</mongo.version>
|
||||
<mongo.version>2.7.1</mongo.version>
|
||||
<querydsl.version>2.2.4</querydsl.version>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -39,6 +39,8 @@ public class GroupByResults<T> implements Iterable<T> {
|
||||
|
||||
private int keys;
|
||||
|
||||
private String serverUsed;
|
||||
|
||||
public GroupByResults(List<T> mappedResults, DBObject rawResults) {
|
||||
Assert.notNull(mappedResults);
|
||||
Assert.notNull(rawResults);
|
||||
@@ -46,6 +48,7 @@ public class GroupByResults<T> implements Iterable<T> {
|
||||
this.rawResults = rawResults;
|
||||
parseKeys();
|
||||
parseCount();
|
||||
parseServerUsed();
|
||||
}
|
||||
|
||||
public double getCount() {
|
||||
@@ -55,6 +58,10 @@ public class GroupByResults<T> implements Iterable<T> {
|
||||
public int getKeys() {
|
||||
return keys;
|
||||
}
|
||||
|
||||
public String getServerUsed() {
|
||||
return serverUsed;
|
||||
}
|
||||
|
||||
public Iterator<T> iterator() {
|
||||
return mappedResults.iterator();
|
||||
@@ -65,18 +72,25 @@ public class GroupByResults<T> implements Iterable<T> {
|
||||
}
|
||||
|
||||
private void parseCount() {
|
||||
Object object = (Object) rawResults.get("count");
|
||||
Object object = rawResults.get("count");
|
||||
if (object instanceof Double) {
|
||||
count = (Double)object;
|
||||
count = (Double) object;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void parseKeys() {
|
||||
Object object = (Object) rawResults.get("keys");
|
||||
Object object = rawResults.get("keys");
|
||||
if (object instanceof Integer) {
|
||||
keys = (Integer)object;
|
||||
keys = (Integer) object;
|
||||
}
|
||||
}
|
||||
|
||||
private void parseServerUsed() {
|
||||
//"serverUsed" : "127.0.0.1:27017"
|
||||
Object object = rawResults.get("serverUsed");
|
||||
if (object instanceof String) {
|
||||
serverUsed = (String) object;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ public class GroupByTests {
|
||||
|
||||
private void assertMapReduceResults(GroupByResults<XObject> results) {
|
||||
DBObject dboRawResults = results.getRawResults();
|
||||
String expected = "{ \"retval\" : [ { \"x\" : 1.0 , \"count\" : 2.0} , { \"x\" : 2.0 , \"count\" : 1.0} , { \"x\" : 3.0 , \"count\" : 3.0}] , \"count\" : 6.0 , \"keys\" : 3 , \"ok\" : 1.0}";
|
||||
String expected = "{ \"serverUsed\" : \"127.0.0.1:27017\" , \"retval\" : [ { \"x\" : 1.0 , \"count\" : 2.0} , { \"x\" : 2.0 , \"count\" : 1.0} , { \"x\" : 3.0 , \"count\" : 3.0}] , \"count\" : 6.0 , \"keys\" : 3 , \"ok\" : 1.0}";
|
||||
Assert.assertEquals(expected, dboRawResults.toString());
|
||||
|
||||
int numResults = 0;
|
||||
|
||||
Reference in New Issue
Block a user