Skip to content

Commit

Permalink
quick cursor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HanaPearlman committed Nov 2, 2020
1 parent 3bf0d78 commit 7090c39
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/cmap/wire_protocol/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Document, pluckBSONSerializeOptions } from '../../bson';
import type { Server } from '../../sdam/server';
import type { ReadPreferenceLike } from '../../read_preference';
import type { FindOptions } from '../../operations/find';
import { Explain } from '../../explain';

/** @internal */
export interface QueryOptions extends CommandOptions {
Expand Down Expand Up @@ -62,7 +63,7 @@ export function query(
}

function prepareFindCommand(server: Server, ns: string, cmd: Document) {
let findCmd: Document = {
const findCmd: Document = {
find: collectionNamespace(ns)
};

Expand Down Expand Up @@ -146,12 +147,9 @@ function prepareFindCommand(server: Server, ns: string, cmd: Document) {
if (cmd.collation) findCmd.collation = cmd.collation;
if (cmd.readConcern) findCmd.readConcern = cmd.readConcern;

// If we have explain, we need to rewrite the find command
// to wrap it in the explain command
if (cmd.explain) {
findCmd = {
explain: findCmd
};
// TODO: Quick fix to make tests pass; will be updated during NODE-2853
if (cmd.explain !== undefined) {
findCmd.explain = Explain.fromOptions({ explain: cmd.explain });
}

return findCmd;
Expand Down

0 comments on commit 7090c39

Please sign in to comment.