• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb-js / mongodb-mcp-server / 14637601756

24 Apr 2025 08:57AM UTC coverage: 42.737% (-32.7%) from 75.474%
14637601756

Pull #103

github

fmenezes
fix: rename describes
Pull Request #103: refactor: split test helpers

30 of 187 branches covered (16.04%)

Branch coverage included in aggregate %.

376 of 763 relevant lines covered (49.28%)

1.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

70.0
/src/tools/mongodb/delete/deleteMany.ts
1
import { z } from "zod";
1✔
2
import { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
3
import { DbOperationArgs, MongoDBToolBase } from "../mongodbTool.js";
1✔
4
import { ToolArgs, OperationType } from "../../tool.js";
5

6
export class DeleteManyTool extends MongoDBToolBase {
1✔
7
    protected name = "delete-many";
2✔
8
    protected description = "Removes all documents that match the filter from a MongoDB collection";
2✔
9
    protected argsShape = {
2✔
10
        ...DbOperationArgs,
11
        filter: z
12
            .object({})
13
            .passthrough()
14
            .optional()
15
            .describe(
16
                "The query filter, specifying the deletion criteria. Matches the syntax of the filter argument of db.collection.deleteMany()"
17
            ),
18
    };
19
    protected operationType: OperationType = "delete";
2✔
20

21
    protected async execute({
22
        database,
23
        collection,
24
        filter,
25
    }: ToolArgs<typeof this.argsShape>): Promise<CallToolResult> {
26
        const provider = await this.ensureConnected();
×
27
        const result = await provider.deleteMany(database, collection, filter);
×
28

29
        return {
×
30
            content: [
31
                {
32
                    text: `Deleted \`${result.deletedCount}\` document(s) from collection "${collection}"`,
33
                    type: "text",
34
                },
35
            ],
36
        };
37
    }
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc