|
|
@@ -205,13 +205,17 @@ var Pipeline = module.exports = (function(){
|
|
|
*/
|
|
|
// the array in which the aggregation results reside
|
|
|
var resultArray = [];
|
|
|
- for(var hasDoc = !inputSource.eof(); hasDoc; hasDoc = inputSource.advance()) {
|
|
|
- var document = inputSource.getCurrent();
|
|
|
- resultArray.push(document); // add the document to the result set
|
|
|
-
|
|
|
- //Commenting out this assertion for munge. MUHAHAHA!!!
|
|
|
- // object will be too large, assert. the extra 1KB is for headers
|
|
|
- //if(resultArray.len() < BSONObjMaxUserSize - 1024) throw new Error("aggregation result exceeds maximum document size (" + BSONObjMaxUserSize / (1024 * 1024) + "MB); code 16389");
|
|
|
+ try{
|
|
|
+ for(var hasDoc = !inputSource.eof(); hasDoc; hasDoc = inputSource.advance()) {
|
|
|
+ var document = inputSource.getCurrent();
|
|
|
+ resultArray.push(document); // add the document to the result set
|
|
|
+
|
|
|
+ //Commenting out this assertion for munge. MUHAHAHA!!!
|
|
|
+ // object will be too large, assert. the extra 1KB is for headers
|
|
|
+ //if(resultArray.len() < BSONObjMaxUserSize - 1024) throw new Error("aggregation result exceeds maximum document size (" + BSONObjMaxUserSize / (1024 * 1024) + "MB); code 16389");
|
|
|
+ }
|
|
|
+ } catch (err) {
|
|
|
+ return callback(err);
|
|
|
}
|
|
|
var result = {
|
|
|
result: resultArray
|