Skip to content

Commit 1ee6708

Browse files
committed
feat: deprecate ServerCapabilities on topology
1 parent 73347be commit 1ee6708

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

src/sdam/topology.ts

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,10 @@ function isStaleServerDescription(
11041104
);
11051105
}
11061106

1107-
/** @public */
1107+
/**
1108+
* @public
1109+
* @deprecated This class will be removed as dead code.
1110+
*/
11081111
export class ServerCapabilities {
11091112
maxWireVersion: number;
11101113
minWireVersion: number;
@@ -1115,37 +1118,37 @@ export class ServerCapabilities {
11151118
}
11161119

11171120
get hasAggregationCursor(): boolean {
1118-
return this.maxWireVersion >= 1;
1121+
return true;
11191122
}
11201123

11211124
get hasWriteCommands(): boolean {
1122-
return this.maxWireVersion >= 2;
1125+
return true;
11231126
}
11241127
get hasTextSearch(): boolean {
1125-
return this.minWireVersion >= 0;
1128+
return true;
11261129
}
11271130

11281131
get hasAuthCommands(): boolean {
1129-
return this.maxWireVersion >= 1;
1132+
return true;
11301133
}
11311134

11321135
get hasListCollectionsCommand(): boolean {
1133-
return this.maxWireVersion >= 3;
1136+
return true;
11341137
}
11351138

11361139
get hasListIndexesCommand(): boolean {
1137-
return this.maxWireVersion >= 3;
1140+
return true;
11381141
}
11391142

11401143
get supportsSnapshotReads(): boolean {
11411144
return this.maxWireVersion >= 13;
11421145
}
11431146

11441147
get commandsTakeWriteConcern(): boolean {
1145-
return this.maxWireVersion >= 5;
1148+
return true;
11461149
}
11471150

11481151
get commandsTakeCollation(): boolean {
1149-
return this.maxWireVersion >= 5;
1152+
return true;
11501153
}
11511154
}

src/utils.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,13 +211,8 @@ export function decorateWithCollation(
211211
target: MongoClient | Db | Collection,
212212
options: AnyOptions
213213
): void {
214-
const capabilities = getTopology(target).capabilities;
215214
if (options.collation && typeof options.collation === 'object') {
216-
if (capabilities && capabilities.commandsTakeCollation) {
217215
command.collation = options.collation;
218-
} else {
219-
throw new MongoCompatibilityError(`Current topology does not support collation`);
220-
}
221216
}
222217
}
223218

0 commit comments

Comments
 (0)