{"record":{"id":"7457ba4bf116b56f","repo":"Budibase/budibase","slug":"actiontype-query-extra-actiontype-does-not-exis-7457ba","errorCode":null,"errorMessage":"actionType ${query.extra.actionType} does not exist on DB for read","messagePattern":"actionType (.+?) does not exist on DB for read","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/integrations/mongodb.ts","lineNumber":550,"sourceCode":"            options: FindOneAndUpdateOptions\n          }\n          return await collection.findOneAndUpdate(\n            findAndUpdateJson.filter,\n            findAndUpdateJson.update,\n            {\n              ...findAndUpdateJson.options,\n              includeResultMetadata: true,\n            }\n          )\n        }\n        case \"count\": {\n          return await collection.countDocuments(json)\n        }\n        case \"distinct\": {\n          return await collection.distinct(json)\n        }\n        default: {\n          throw new Error(\n            `actionType ${query.extra.actionType} does not exist on DB for read`\n          )\n        }\n      }\n    } catch (err) {\n      console.error(\"Error querying mongodb\", err)\n      throw err\n    } finally {\n      await this.client.close()\n    }\n  }\n\n  async update(query: MongoDBQuery): Promise<UpdateResult> {\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":532,"sourceCodeEnd":568,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/integrations/mongodb.ts#L532-L568","documentation":"MongoDB integration's read() switches on query.extra.actionType (find, findOne, aggregate, count/countDocuments, distinct, etc.). If the actionType matches none of the supported read cases, the default branch throws 'actionType <X> does not exist on DB for read'.","triggerScenarios":"Executing a read query whose actionType is misspelled, empty, or belongs to another operation family (e.g. 'insertOne', 'deleteMany') instead of a supported read action.","commonSituations":"Queries migrated or hand-edited with wrong actionType; copy-pasting payloads from another connector; typos like 'findmany' or 'Find'.","solutions":["Set query.extra.actionType to a supported read action (e.g. \"find\", \"findOne\", \"aggregate\", \"count\", \"distinct\")","Re-create the query in the builder to regenerate a valid payload","Whitelist/validate actionType before dispatching the query","Check case sensitivity and spelling of the actionType value"],"exampleFix":"// before\nconst query = { table: \"users\", json: {}, extra: { actionType: \"select\" } }\n// after\nconst query = { table: \"users\", json: {}, extra: { actionType: \"find\" } }","handlingStrategy":"validation","validationCode":"const READ_ACTIONS = [\"search\", \"lookup\", \"aggregate\", \"count\", \"distinct\"]\nif (!READ_ACTIONS.includes(query.extra?.actionType)) {\n  throw new Error(`Invalid read actionType: ${query.extra?.actionType}`)\n}\nawait ds.read(query)","typeGuard":"function isReadAction(t: unknown): t is \"search\" | \"lookup\" | \"aggregate\" | \"count\" | \"distinct\" {\n  return typeof t === \"string\" && [\"search\", \"lookup\", \"aggregate\", \"count\", \"distinct\"].includes(t)\n}","tryCatchPattern":"try {\n  return await ds.read(query)\n} catch (err) {\n  if (err.message.includes(\"does not exist on DB for read\")) {\n    throw new Error(`Unsupported MongoDB read action \"${query.extra?.actionType}\"; use search, lookup, aggregate, count or distinct`, { cause: err })\n  }\n  throw err\n}","preventionTips":["Use the builder UI to generate read queries instead of hand-writing payloads","Validate actionType against the supported read list before execution","Avoid copying MongoDB shell verbs (find, findOne) into Budibase query JSON","Re-check query payloads after version upgrades or manual edits"],"tags":["mongodb","action-type","read","validation"],"backgroundTag":"unsupported-operation","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}