Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/routerlicious/packages/services/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"ioredis": "^5.6.1",
"lodash": "^4.18.1",
"lru-cache": "^6.0.0",
"mongodb": "^5.9.2",
"mongodb": "^6.21.0",
"nconf": "^0.12.0",
"socket.io": "^4.8.3",
"telegrafjs": "^0.1.3",
Expand Down
17 changes: 5 additions & 12 deletions server/routerlicious/packages/services/src/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export class MongoCollection<T extends Document> implements core.ICollection<T>,
query: any,
value: any,
options = {
returnOriginal: true,
returnDocument: "before" as const,
upsert: true,
},
): Promise<{ value: T; existing: boolean }> {
Expand All @@ -316,8 +316,8 @@ export class MongoCollection<T extends Document> implements core.ICollection<T>,
options,
);

return result.value
? { value: result.value, existing: true }
return result
? { value: result as unknown as T, existing: true }
: { value, existing: false };
} catch (sdkError) {
const error = this.cloneError(sdkError);
Expand Down Expand Up @@ -345,8 +345,8 @@ export class MongoCollection<T extends Document> implements core.ICollection<T>,
options,
);

return result.value
? { value: result.value, existing: true }
return result
? { value: result as unknown as T, existing: true }
: { value, existing: false };
} catch (sdkError) {
const error = this.cloneError(sdkError);
Expand Down Expand Up @@ -629,7 +629,6 @@ const DefaultMongoDbMonitoringEvents = [
"connectionPoolCleared",
];
const DefaultHeartbeatFrequencyMS = 30000;
const DefaultKeepAliveInitialDelay = 60000;
const DefaultSocketTimeoutMS = 0;
const DefaultConnectionTimeoutMS = 120000;
const DefaultMinHeartbeatFrequencyMS = 10000;
Expand All @@ -656,7 +655,6 @@ interface IMongoDBConfig {
connectionNotAvailableMode?: ConnectionNotAvailableMode;
dbMonitoringEventsList?: string[];
heartbeatFrequencyMS?: number;
keepAliveInitialDelay?: number;
socketTimeoutMS?: number;
connectionTimeoutMS?: number;
minHeartbeatFrequencyMS?: number;
Expand All @@ -682,7 +680,6 @@ export class MongoDbFactory implements core.IDbFactory {
private readonly retryRuleOverride: Map<string, boolean>;
private readonly dbMonitoringEventsList: string[];
private readonly heartbeatFrequencyMS: number;
private readonly keepAliveInitialDelay: number;
private readonly socketTimeoutMS: number;
private readonly connectionTimeoutMS: number;
private readonly minHeartbeatFrequencyMS: number;
Expand All @@ -706,7 +703,6 @@ export class MongoDbFactory implements core.IDbFactory {
connectionNotAvailableMode,
dbMonitoringEventsList,
heartbeatFrequencyMS,
keepAliveInitialDelay,
socketTimeoutMS,
connectionTimeoutMS,
minHeartbeatFrequencyMS,
Expand Down Expand Up @@ -738,7 +734,6 @@ export class MongoDbFactory implements core.IDbFactory {
: new Map();
this.dbMonitoringEventsList = dbMonitoringEventsList ?? DefaultMongoDbMonitoringEvents;
this.heartbeatFrequencyMS = heartbeatFrequencyMS ?? DefaultHeartbeatFrequencyMS;
this.keepAliveInitialDelay = keepAliveInitialDelay ?? DefaultKeepAliveInitialDelay;
this.socketTimeoutMS = socketTimeoutMS ?? DefaultSocketTimeoutMS;
this.connectionTimeoutMS = connectionTimeoutMS ?? DefaultConnectionTimeoutMS;
this.minHeartbeatFrequencyMS = minHeartbeatFrequencyMS ?? DefaultMinHeartbeatFrequencyMS;
Expand All @@ -762,8 +757,6 @@ export class MongoDbFactory implements core.IDbFactory {
// Need to cast to any before MongoClientOptions due to missing properties in d.ts
const options: MongoClientOptions = {
directConnection: this.directConnection ?? false,
keepAlive: true,
keepAliveInitialDelay: this.keepAliveInitialDelay,
socketTimeoutMS: this.socketTimeoutMS,
connectTimeoutMS: this.connectionTimeoutMS,
heartbeatFrequencyMS: this.heartbeatFrequencyMS,
Expand Down
85 changes: 64 additions & 21 deletions server/routerlicious/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading