@@ -13,10 +13,12 @@ const aggregator = [
1313 output : {
1414 rowNumber : {
1515 $documentNumber : { } ,
16- window : [ 'unbounded' , 'current' ] ,
16+ // window: ['unbounded', 'current'],
1717 } ,
1818 } ,
1919 } ,
20+ } ,
21+ {
2022 $match : {
2123 rowNumber : { $lte : 50 } ,
2224 } ,
@@ -27,10 +29,14 @@ const aggregator = [
2729// Create an aggregator based on the aggregator variable
2830// return the result
2931fetchData . mongoFetch = async function ( serviceName ) {
30- const testModel = HealthModelFunc ( serviceName ) ;
31- let result = await testModel . aggregate ( aggregator ) ;
32- result = [ { [ serviceName ] : result } ] ;
33- return result ;
32+ try {
33+ const testModel = HealthModelFunc ( serviceName ) ;
34+ let result = await testModel . aggregate ( aggregator ) ;
35+ result = [ { [ serviceName ] : result } ] ;
36+ return result ;
37+ } catch ( error ) {
38+ console . log ( 'Aggregation error in mongoFetch(): ' , error ) ;
39+ }
3440} ;
3541
3642fetchData . postgresFetch = async function ( serviceName , pool ) {
@@ -53,12 +59,11 @@ fetchData.postgresFetch = async function (serviceName, pool) {
5359 ;` ;
5460
5561 let result = await pool . query ( query ) ;
56- console . log ( " result.rows in dataHelpers postgresFetch:" , JSON . stringify ( result . rows ) ) ;
62+ console . log ( ' result.rows in dataHelpers postgresFetch:' , JSON . stringify ( result . rows ) ) ;
5763 result = result . rows ;
5864 result = [ { [ serviceName ] : result } ] ;
59- console . log ( " result with servicename in dataHelpers postgresFetch:" , JSON . stringify ( result ) ) ;
65+ console . log ( ' result with servicename in dataHelpers postgresFetch:' , JSON . stringify ( result ) ) ;
6066 return result ;
6167} ;
6268
6369export { fetchData } ;
64-
0 commit comments