|
|
@@ -183,21 +183,25 @@ var Pipeline = module.exports = (function(){
|
|
|
*/
|
|
|
// the array in which the aggregation results reside
|
|
|
// cant use subArrayStart() due to error handling
|
|
|
- var resultArray = [];
|
|
|
- for(var hasDoc = !source.eof(); hasDoc; hasDoc = source.advance()) {
|
|
|
- var document = source.getCurrent();
|
|
|
- /* add the document to the result set */
|
|
|
- resultArray.push(document);
|
|
|
-
|
|
|
- //Commenting out this assertion for munge. MUHAHAHA!!!
|
|
|
-
|
|
|
- // object will be too large, assert. the extra 1KB is for headers
|
|
|
- // uassert(16389,
|
|
|
- // str::stream() << "aggregation result exceeds maximum document size (" << BSONObjMaxUserSize / (1024 * 1024) << "MB)",
|
|
|
- // resultArray.len() < BSONObjMaxUserSize - 1024);
|
|
|
+ try{
|
|
|
+ var resultArray = [];
|
|
|
+ for(var hasDoc = !source.eof(); hasDoc; hasDoc = source.advance()) {
|
|
|
+ var document = source.getCurrent();
|
|
|
+ /* add the document to the result set */
|
|
|
+ resultArray.push(document);
|
|
|
+
|
|
|
+ //Commenting out this assertion for munge. MUHAHAHA!!!
|
|
|
+
|
|
|
+ // object will be too large, assert. the extra 1KB is for headers
|
|
|
+ // uassert(16389,
|
|
|
+ // str::stream() << "aggregation result exceeds maximum document size (" << BSONObjMaxUserSize / (1024 * 1024) << "MB)",
|
|
|
+ // resultArray.len() < BSONObjMaxUserSize - 1024);
|
|
|
+ }
|
|
|
+ result.result = resultArray;
|
|
|
+ result.ok = true;
|
|
|
+ } catch (ex){
|
|
|
+ return callback(ex);
|
|
|
}
|
|
|
- result.result = resultArray;
|
|
|
- result.ok = true;
|
|
|
return callback(null, result);
|
|
|
}
|
|
|
);
|