Skip to content

Commit

Permalink
Use optons?: Document
Browse files Browse the repository at this point in the history
  • Loading branch information
mongodb-matthew-normyle committed Oct 31, 2024
1 parent e136f6a commit 37cd6b2
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions packages/shell-api/src/stream-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,21 @@ export default class StreamProcessor extends ShellApiWithMongoClass {
* sp.name.modify(newPipeline)
* Keep the same pipeline, change other options:
* sp.name.modify({resumeFromCheckpoint: false})
* Change the pipeline and set additional options:
* sp.name.modify(newPipeline, {resumeFromCheckpoint: false})
*/
async modify(options: Document): Promise<Document>;
async modify(pipeline: Document[], options?: Document): Promise<Document>;

/**
* modify is used to modify a stream processor definition, like below:
* Change the pipeline and set additional options:
* sp.name.modify(newPipeline, {resumeFromCheckpoint: false})
*/
@returnsPromise
async modify(
pipelineOrOptions: Document[] | Document,
options: Document = {}
options?: Document
): Promise<Document> {
if (Array.isArray(pipelineOrOptions)) {
options = { ...options, pipeline: pipelineOrOptions };
} else if (typeof pipelineOrOptions === 'object') {
if (Object.keys(options).length !== 0) {
if (options) {
throw new MongoshInvalidInputError(
'If the first argument to modify is an object, the second argument should not be specified.',
CommonErrors.InvalidArgument
Expand Down

0 comments on commit 37cd6b2

Please sign in to comment.