Skip to content

Commit a07780c

Browse files
committed
fix: use runCommandWithCheck for database commands
1 parent 872ab03 commit a07780c

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/tools/mongodb/delete/deleteMany.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class DeleteManyTool extends MongoDBToolBase {
2828
// Check if delete operation uses an index if enabled
2929
if (this.config.indexCheck) {
3030
await checkIndexUsage(provider, database, collection, "deleteMany", async () => {
31-
return provider.mongoClient.db(database).command({
31+
return provider.runCommandWithCheck(database, {
3232
explain: {
3333
delete: collection,
3434
deletes: [

src/tools/mongodb/metadata/explain.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class ExplainTool extends MongoDBToolBase {
7676
}
7777
case "count": {
7878
const { query } = method.arguments;
79-
result = await provider.mongoClient.db(database).command({
79+
result = await provider.runCommandWithCheck(database, {
8080
explain: {
8181
count: collection,
8282
query,

src/tools/mongodb/read/count.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class CountTool extends MongoDBToolBase {
3030
// Check if count operation uses an index if enabled
3131
if (this.config.indexCheck) {
3232
await checkIndexUsage(provider, database, collection, "count", async () => {
33-
return provider.mongoClient.db(database).command({
33+
return provider.runCommandWithCheck(database, {
3434
explain: {
3535
count: collection,
3636
query,

src/tools/mongodb/update/updateMany.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export class UpdateManyTool extends MongoDBToolBase {
3737
// Check if update operation uses an index if enabled
3838
if (this.config.indexCheck) {
3939
await checkIndexUsage(provider, database, collection, "updateMany", async () => {
40-
return provider.mongoClient.db(database).command({
40+
return provider.runCommandWithCheck(database, {
4141
explain: {
4242
update: collection,
4343
updates: [

0 commit comments

Comments
 (0)