@View(name = "maxCallDuration", map = "function(doc){ emit(null, doc.duration);}", reduce = "function (key, values) {" + " var max = 0;" + " for(var i = 0; i < values.length; i++) {" + " max = Math.max(values[i], max);" + " }" + " return max;" + "}") public long findMaxCallDuration() { ViewResult result = db.queryView(createQuery("maxCallDuration").reduce(true)); if (!result.isEmpty() && result.iterator().hasNext()) { return Integer.valueOf(result.iterator().next().getValue()); } return 0; }
@View(name = "maxCallDuration", map = "function(doc){ emit(null, doc.duration);}", reduce = "function (key, values) {" + " var max = 0;" + " for(var i = 0; i < values.length; i++) {" + " max = Math.max(values[i], max);" + " }" + " return max;" + "}") public long findMaxCallDuration() { ViewResult result = db.queryView(createQuery("maxCallDuration").reduce(true)); if (!result.isEmpty() && result.iterator().hasNext()) { return Integer.valueOf(result.iterator().next().getValue()); } return 0; }