{"record":{"id":"1066ea64345cd4f0","repo":"Budibase/budibase","slug":"actiontype-query-extra-actiontype-does-not-exis-1066ea","errorCode":null,"errorMessage":"actionType ${query.extra.actionType} does not exist on DB for delete","messagePattern":"actionType (.+?) does not exist on DB for delete","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/integrations/mongodb.ts","lineNumber":635,"sourceCode":"        filter: Filter<any>\n        options: OperationOptions\n      }\n      if (!json.options) {\n        json = {\n          filter: json,\n          options: {},\n        }\n      }\n\n      switch (query.extra.actionType) {\n        case \"deleteOne\": {\n          return await collection.deleteOne(json.filter, json.options)\n        }\n        case \"deleteMany\": {\n          return await collection.deleteMany(json.filter, json.options)\n        }\n        default: {\n          throw new Error(\n            `actionType ${query.extra.actionType} does not exist on DB for delete`\n          )\n        }\n      }\n    } catch (err) {\n      console.error(\"Error writing to mongodb\", err)\n      throw err\n    } finally {\n      await this.client.close()\n    }\n  }\n\n  async aggregate(query: {\n    json: object\n    steps: any[]\n    extra: { [key: string]: string }\n  }): Promise<Document[]> {\n    try {","sourceCodeStart":617,"sourceCodeEnd":653,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/integrations/mongodb.ts#L617-L653","documentation":"MongoDB integration's delete() switches on query.extra.actionType to pick deleteOne or deleteMany (with filter and options). If the actionType is not one of these, the default branch throws 'actionType <X> does not exist on DB for delete'.","triggerScenarios":"Executing a delete query whose actionType is misspelled, empty, or belongs to another family (e.g. 'remove', 'delete' instead of 'deleteOne'/'deleteMany').","commonSituations":"Payloads copied from Mongoose or shell syntax ('remove') into Budibase queries; hand-edited query JSON; queries created before an action rename or migration.","solutions":["Set query.extra.actionType to exactly \"deleteOne\" or \"deleteMany\"","Ensure json.filter targets the documents to remove and json.options is a valid DeleteOptions object","Re-create or re-save the query in the builder so it emits a valid actionType","Validate actionType against the supported delete actions before dispatch"],"exampleFix":"// before\nconst query = { table: \"users\", json: { filter: { stale: true } }, extra: { actionType: \"remove\" } }\n// after\nconst query = { table: \"users\", json: { filter: { stale: true } }, extra: { actionType: \"deleteMany\" } }","handlingStrategy":"validation","validationCode":"const DELETE_ACTIONS = [\"deleteOne\", \"deleteMany\"]\nif (!DELETE_ACTIONS.includes(query.extra?.actionType)) {\n  throw new Error(`Invalid delete actionType: ${query.extra?.actionType}`)\n}\nawait ds.delete(query)","typeGuard":"function isDeleteAction(t: unknown): t is \"deleteOne\" | \"deleteMany\" {\n  return t === \"deleteOne\" || t === \"deleteMany\"\n}","tryCatchPattern":"try {\n  await ds.delete(query)\n} catch (err) {\n  if (err.message.includes(\"does not exist on DB for delete\")) {\n    throw new Error(`Unsupported MongoDB delete action \"${query.extra?.actionType}\"; use deleteOne or deleteMany`, { cause: err })\n  }\n  throw err\n}","preventionTips":["Map Mongoose 'remove' style calls to deleteOne/deleteMany when porting","Include json.filter so deletes are targeted, and validate actionType first","Prefer builder-generated delete queries over hand-written payloads","Sanity-check query JSON after migrations or upgrades"],"tags":["mongodb","action-type","delete","validation"],"backgroundTag":"unsupported-operation","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}