{"record":{"id":"2e21f9ef3c1c61cc","repo":"Budibase/budibase","slug":"actiontype-query-extra-actiontype-does-not-exis-2e21f9","errorCode":null,"errorMessage":"actionType ${query.extra.actionType} does not exist on DB for update","messagePattern":"actionType (.+?) does not exist on DB for update","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/integrations/mongodb.ts","lineNumber":594,"sourceCode":"      }\n\n      switch (query.extra.actionType) {\n        case \"updateOne\": {\n          return await collection.updateOne(\n            json.filter,\n            json.update,\n            json.options as UpdateOptions\n          )\n        }\n        case \"updateMany\": {\n          return await collection.updateMany(\n            json.filter,\n            json.update,\n            json.options as UpdateOptions\n          )\n        }\n        default: {\n          throw new Error(\n            `actionType ${query.extra.actionType} does not exist on DB for update`\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 delete(query: MongoDBQuery): Promise<DeleteResult> {\n    try {\n      await this.connect()\n      const db = this.client.db(this.config.db)\n      const collection = db.collection(query.extra.collection)\n      let queryJson = query.json","sourceCodeStart":576,"sourceCodeEnd":612,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/integrations/mongodb.ts#L576-L612","documentation":"MongoDB integration's update() switches on query.extra.actionType to pick updateOne or updateMany (with filter, update, options). If the actionType is not a supported update operation, the default branch throws 'actionType <X> does not exist on DB for update'.","triggerScenarios":"Executing an update query whose actionType is misspelled, empty, or not an update-family action (e.g. 'update' instead of 'updateOne', or 'replaceOne' when unsupported by the mapping).","commonSituations":"Hand-built JSON payloads missing the exact action names; queries copied from MongoDB shell syntax into Budibase queries; schema drift after editing a query's operation type in the UI.","solutions":["Set query.extra.actionType to exactly \"updateOne\" or \"updateMany\"","Ensure the JSON payload includes filter and update fields compatible with the chosen action","Re-create or re-save the query in the builder so the generated payload matches the operation","Validate actionType against the supported list before execution"],"exampleFix":"// before\nconst query = { table: \"users\", json: { filter: { _id: 1 }, update: { $set: { name: \"x\" } } }, extra: { actionType: \"update\" } }\n// after\nconst query = { table: \"users\", json: { filter: { _id: 1 }, update: { $set: { name: \"x\" } } }, extra: { actionType: \"updateOne\" } }","handlingStrategy":"validation","validationCode":"const UPDATE_ACTIONS = [\"updateOne\", \"updateMany\"]\nif (!UPDATE_ACTIONS.includes(query.extra?.actionType)) {\n  throw new Error(`Invalid update actionType: ${query.extra?.actionType}`)\n}\nawait ds.update(query)","typeGuard":"function isUpdateAction(t: unknown): t is \"updateOne\" | \"updateMany\" {\n  return t === \"updateOne\" || t === \"updateMany\"\n}","tryCatchPattern":"try {\n  await ds.update(query)\n} catch (err) {\n  if (err.message.includes(\"does not exist on DB for update\")) {\n    throw new Error(`Unsupported MongoDB update action \"${query.extra?.actionType}\"; use updateOne or updateMany`, { cause: err })\n  }\n  throw err\n}","preventionTips":["Use exactly updateOne/updateMany, not shell-style 'update' or 'replaceOne' unless supported","Always include filter and update in the JSON payload","Generate queries via the builder to avoid actionType drift","Validate actionType when importing or hand-editing query definitions"],"tags":["mongodb","action-type","update","validation"],"backgroundTag":"unsupported-operation","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}