Skip to content

Commit 5ff2da5

Browse files
changed document type mongo
1 parent ce5092b commit 5ff2da5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

modules/module-mongodb-storage/src/storage/MongoReportStorage.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ export class MongoReportStorage implements storage.ReportStorageFactory {
1818
}
1919

2020
async reportSdkConnect(data: SdkConnectDocument): Promise<void> {
21+
console.log(data);
2122
await this.db.sdk_report_events.insertOne(data);
2223
}
2324
async reportSdkDisconnect(data: SdkConnectDocument): Promise<void> {
24-
console.log('MongoReportStorage.reportSdkDisconnect', data);
25+
console.log(data);
26+
await this.db.sdk_report_events.findOneAndUpdate({ _id: data._id }, data, { upsert: true });
2527
}
2628
async listCurrentConnections(data: event_types.PaginatedInstanceRequest): Promise<void> {
2729
console.log('MongoReportStorage.listCurrentConnections', data);

packages/types/src/events.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export type SdkConnectDocument = {
3737
client_id: string;
3838
user_id: string;
3939
jwt_exp?: Date;
40-
connect_at: Date;
40+
connect_at?: Date;
4141
disconnect_at?: Date;
4242
};
4343

0 commit comments

Comments
 (0)