{"record":{"id":"0cf740bd3c2e3fad","repo":"overleaf/overleaf","slug":"mongo-is-running-without-notablescan","errorCode":null,"errorMessage":"mongo is running without --notablescan","messagePattern":"mongo is running without --notablescan","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"services/web/scripts/e2e_test_setup.mjs","lineNumber":215,"sourceCode":"}\n\nasync function checkNoTableScan() {\n  const client = await connectionPromise\n  const { notablescan } = await client\n    .db()\n    .admin()\n    .command({ getParameter: 1, notablescan: 1 })\n  if (!notablescan) {\n    console.error()\n    console.error('!!!  mongo is running without --notablescan')\n    console.error()\n    console.error('To fix this, either')\n    console.error('- run \"internal$ bin/e2e_test_setup\"')\n    console.error(\n      '- or add MONGO_EXTRA_ARGS=--notablescan in config/local.env and apply with \"internal$ bin/up mongo\"'\n    )\n    console.error()\n    throw new Error('mongo is running without --notablescan')\n  }\n}\n\nasync function main() {\n  if (process.env.NODE_ENV !== 'development') {\n    throw new Error('only available in dev-env')\n  }\n  await checkNoTableScan()\n\n  await Promise.all([purgeNewUsers(), provisionUsers(), provisionSplitTests()])\n}\n\nif (import.meta.main) {\n  await main()\n  await GracefulShutdown.gracefulShutdown()\n}\n","sourceCodeStart":197,"sourceCodeEnd":232,"githubUrl":"https://github.com/overleaf/overleaf/blob/28ad3b03b71cb4311decdcb55c36b33ec10d72db/services/web/scripts/e2e_test_setup.mjs#L197-L232","documentation":"This setup script for e2e tests verifies that the local MongoDB instance is started with the --notablescan flag, which disables slow-query table-scan warnings/errors. If the running mongod was started without it, the checkNoTableScan helper logs fix instructions and throws so the developer reconfigures their dev MongoDB before provisioning e2e data.","triggerScenarios":"Running `node services/web/scripts/e2e_test_setup.mjs` (or bin/e2e_test_setup) while the local mongo container/process lacks --notablescan in its arguments (e.g. mongo started manually or via bin/up without MONGO_EXTRA_ARGS set).","commonSituations":"Fresh clone where the developer started mongo manually with docker run or mongod directly; resetting config/local.env and losing MONGO_EXTRA_ARGS; switching from a teammate's setup script to a plain mongo startup.","solutions":["Add MONGO_EXTRA_ARGS=--notablescan in config/local.env and restart mongo with `internal$ bin/up mongo`","Or run the wrapper `internal$ bin/e2e_test_setup`, which starts mongo with the right flags before running the setup","Verify with `ps aux | grep mongod` (or docker inspect) that --notablescan is present before rerunning"],"exampleFix":"# before (config/local.env)\n# MONGO_EXTRA_ARGS not set\n# after\nMONGO_EXTRA_ARGS=--notablescan","handlingStrategy":"validation","validationCode":"// check mongod flags before running the setup\nconst { execSync } = require('child_process')\nconst ps = execSync('ps aux | grep [m]ongod || docker inspect mongo').toString()\nif (!ps.includes('--notablescan')) {\n  throw new Error('start mongo with --notablescan (MONGO_EXTRA_ARGS=--notablescan in config/local.env, then bin/up mongo)')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always start dev mongo via bin/up mongo with MONGO_EXTRA_ARGS=--notablescan in config/local.env","Use the bin/e2e_test_setup wrapper instead of starting mongod manually","Keep config/local.env committed to your team's onboarding doc so the flag is never lost"],"tags":["mongodb","dev-environment","configuration"],"backgroundTag":"mongo-notablescan-flag-missing","analyzedSha":"28ad3b03b71cb4311decdcb55c36b33ec10d72db","analyzedAt":"2026-09-03T02:10:22.807Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}