@@ -178,7 +178,7 @@ export class MongoReportStorage implements storage.ReportStorageFactory {
178
178
const { interval, timeframe } = data ;
179
179
const timeframeFilter = this . timeFrameQuery ( timeframe , interval ) ;
180
180
const result = await this . db . sdk_report_events
181
- . aggregate ( [
181
+ . aggregate < event_types . ListCurrentConnections > ( [
182
182
{
183
183
$match : {
184
184
connect_at : timeframeFilter
@@ -188,7 +188,7 @@ export class MongoReportStorage implements storage.ReportStorageFactory {
188
188
this . sdkProjectPipeline ( )
189
189
] )
190
190
. toArray ( ) ;
191
- return result [ 0 ] as event_types . ListCurrentConnections ;
191
+ return result [ 0 ] ;
192
192
}
193
193
194
194
async reportSdkConnect ( data : event_types . SdkConnectBucketData ) : Promise < void > {
@@ -234,9 +234,12 @@ export class MongoReportStorage implements storage.ReportStorageFactory {
234
234
this . sdkProjectPipeline ( )
235
235
] )
236
236
. explain ( ) ;
237
- console . log ( explain ) ;
237
+ explain . stages . map ( ( stage : any ) => {
238
+ const key = Object . keys ( stage ) [ 0 ] ;
239
+ console . log ( JSON . stringify ( stage [ key ] , null , 2 ) ) ;
240
+ } ) ;
238
241
const result = await this . db . sdk_report_events
239
- . aggregate ( [
242
+ . aggregate < event_types . ListCurrentConnections > ( [
240
243
{
241
244
$match : {
242
245
disconnect_at : { $exists : false } ,
@@ -248,7 +251,7 @@ export class MongoReportStorage implements storage.ReportStorageFactory {
248
251
this . sdkProjectPipeline ( )
249
252
] )
250
253
. toArray ( ) ;
251
- return result [ 0 ] as event_types . ListCurrentConnections ;
254
+ return result [ 0 ] ;
252
255
}
253
256
254
257
async [ Symbol . asyncDispose ] ( ) {
0 commit comments