Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/shell-api/src/database.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion packages/shell-api/src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -787,8 +787,11 @@ export default class Database extends ShellApiWithMongoClass {

@returnsPromise
@apiVersions([])
async currentOp(opts: Document = {}): Promise<Document> {
async currentOp(opts: Document | boolean = {}): Promise<Document> {
this._emitDatabaseApiCall('currentOp', { opts: opts });
if (typeof opts === 'boolean') {
opts = { $all: opts };
}
return await this._runAdminCommand(
{
currentOp: 1,
Expand Down