Mongodb映射减少结果格式更改

Mongodb映射减少结果格式更改,mongodb,mapreduce,Mongodb,Mapreduce,我正在使用java api并调用以下map reduce命令: MAP function() { emit('nogroup',{endtime: this.endtime, _owner: this._owner}); } REDUCE function Reduce(key, values) { var res = 3426533531976; for ( var i=0; i<values.length; i++ ) { if ( values[i].endtime <

我正在使用java api并调用以下map reduce命令:

MAP
function() { 
emit('nogroup',{endtime: this.endtime, _owner: this._owner}); 
}

REDUCE
function Reduce(key, values) { 
var res = 3426533531976; 
for ( var i=0; i<values.length; i++ ) {
if ( values[i].endtime < res && values[i]._owner == null  ) 
res = values[i].endtime; 
} 
return res;
}
有时候像这样

{ "_id" : "nogroup" , "value" : 9.426533531976E12}
如何始终使用相同的代码提取长期结果

目前我有

for (DBObject a : out.results()) {
    return ((BasicDBObject) a.get("value")).getLong("floatApprox");
}

但这仅适用于FloatAbrox变体

只需在以下内容后添加一个复选框:

res = values[i].endtime; 
例如

for (DBObject a : out.results()) {
    return ((BasicDBObject) a.get("value")).getLong("floatApprox");
}
res = values[i].endtime; 
res = values[i].endtime;
if ( typeof res == "object"){
  res = res.floatApprox;
}