diff --git a/packages/shell-api/src/database.spec.ts b/packages/shell-api/src/database.spec.ts index 2a37fe9833..fd53b9f2a1 100644 --- a/packages/shell-api/src/database.spec.ts +++ b/packages/shell-api/src/database.spec.ts @@ -1555,6 +1555,28 @@ describe('Database', () => { { currentOp: 1 } ); }); + it('allows boolean parameter', async() => { + await database.currentOp(true); + + expect(serviceProvider.runCommandWithCheck).to.have.been.calledWith( + ADMIN_DB, + { + currentOp: 1, + $all: true + } + ); + }); + it('allows boolean parameter false', async() => { + await database.currentOp(false); + + expect(serviceProvider.runCommandWithCheck).to.have.been.calledWith( + ADMIN_DB, + { + $all: false, + currentOp: 1 + } + ); + }); it('calls serviceProvider.runCommandWithCheck on the database with options', async() => { await database.currentOp({ $ownOps: true, diff --git a/packages/shell-api/src/database.ts b/packages/shell-api/src/database.ts index ca8afd9503..f99c1a056e 100644 --- a/packages/shell-api/src/database.ts +++ b/packages/shell-api/src/database.ts @@ -787,8 +787,11 @@ export default class Database extends ShellApiWithMongoClass { @returnsPromise @apiVersions([]) - async currentOp(opts: Document = {}): Promise { + async currentOp(opts: Document | boolean = {}): Promise { this._emitDatabaseApiCall('currentOp', { opts: opts }); + if (typeof opts === 'boolean') { + opts = { $all: opts }; + } return await this._runAdminCommand( { currentOp: 1,