Skip to main content
Glama

mcp-google-sheets

delete-documents.ts1.4 kB
import { createAction, Property } from '@activepieces/pieces-framework'; import { mongodbAuth } from '../..'; import { mongodbCommon, mongodbConnect } from '../common'; export default createAction({ auth: mongodbAuth, name: 'delete_documents', displayName: 'Delete Documents', description: 'Delete documents from a collection', props: { database: mongodbCommon.database, collection: mongodbCommon.collection(), filter: Property.Json({ displayName: 'Filter', description: 'MongoDB query to select documents to delete (e.g., {"status": "archived"})', required: true, }), }, async run(context) { const client = await mongodbConnect(context.auth); try { if (!context.propsValue.collection) { throw new Error('Collection is required'); } const databaseName = context.propsValue.database || context.auth.database; if (!databaseName) { throw new Error('Database is required. Please specify it in the connection settings or in this action.'); } const db = client.db(databaseName); const collection = db.collection(context.propsValue.collection); const filter = context.propsValue.filter || {}; const result = await collection.deleteMany(filter); return { deletedCount: result.deletedCount, }; } finally { await client.close(); } }, });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/activepieces/activepieces'

If you have feedback or need assistance with the MCP directory API, please join our Discord server