Skip to content

Commit 97294d9

Browse files
committed
remove shouldUseLegacyQuery
1 parent 6bfa94a commit 97294d9

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/cmap/wire_protocol/query.ts

+1-8
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function query(
2727
return callback(new MongoError(`command ${JSON.stringify(cmd)} does not return a cursor`));
2828
}
2929

30-
if (shouldUseLegacyQuery(server, options)) {
30+
if (maxWireVersion(server) < 4) {
3131
const query = prepareLegacyFindQuery(server, ns, cmd, options);
3232
const queryOptions = applyCommonQueryOptions(
3333
{},
@@ -69,13 +69,6 @@ export function query(
6969
command(server, ns, findCmd, commandOptions, callback);
7070
}
7171

72-
// Typically, a legacy find query is used for wire versions prior to 4. However, for explain with
73-
// find on wire versions between 3 and 4, we can't use a legacy find command.
74-
function shouldUseLegacyQuery(server: Server, options: FindOptions): boolean {
75-
const wireVersion = maxWireVersion(server);
76-
return wireVersion <= 3 || (wireVersion < 4 && options.explain === undefined);
77-
}
78-
7972
function prepareFindCommand(server: Server, ns: string, cmd: Document) {
8073
const findCmd: Document = {
8174
find: collectionNamespace(ns)

0 commit comments

Comments
 (0)