-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: db.command to not inherit options from parent
Fixes `db.command` method to not inherit readPreference, writeConcern, readConcern from parent. centralizes readPreference helpers translate, resolve, fromOptions to the ReadPreference class. Adds Aspect "NO_INHERIT_OPTIONS" to command operations for flagging specific operations. Creates `RunCommand` operation to wrap `CommandV2`, updating `db.command` to use `CommandV2`. NODE-2649
- Loading branch information
Thomas Reggi
authored
Jul 12, 2020
1 parent
eff550d
commit 8f6c247
Showing
5 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import CommandOperationV2 = require('./command_v2'); | ||
import { defineAspects, Aspect } from './operation'; | ||
import Db = require('../db'); | ||
import Collection = require('../collection'); | ||
import MongoClient = require('../mongo_client'); | ||
import { Server } from '../sdam/server'; | ||
|
||
class RunCommandOperation extends CommandOperationV2 { | ||
command: any; | ||
constructor(parent: MongoClient | Db | Collection, command: any, options: any) { | ||
super(parent, options); | ||
this.command = command; | ||
} | ||
execute(server: Server, callback: any) { | ||
const command = this.command; | ||
this.executeCommand(server, command, callback); | ||
} | ||
} | ||
defineAspects(RunCommandOperation, [Aspect.EXECUTE_WITH_SELECTION, Aspect.NO_INHERIT_OPTIONS]); | ||
|
||
export = RunCommandOperation; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters