{"record":{"id":"ef5538d05458d5d8","repo":"mongodb/node-mongodb-native","slug":"optionword-array-from-unsupportedoptions-joi","errorCode":null,"errorMessage":"${optionWord} ${Array.from(unsupportedOptions).join(', ')} ${isOrAre} not supported","messagePattern":"(.+?) (.+?) (.+?) not supported","errorType":"exception","errorClass":"MongoParseError","httpStatus":null,"severity":"error","filePath":"src/connection_string.ts","lineNumber":369,"sourceCode":"  if (allProvidedOptions.has('tls') || allProvidedOptions.has('ssl')) {\n    const tlsAndSslOpts = (allProvidedOptions.get('tls') || [])\n      .concat(allProvidedOptions.get('ssl') || [])\n      .map(getBoolean.bind(null, 'tls/ssl'));\n    if (new Set(tlsAndSslOpts).size !== 1) {\n      throw new MongoParseError('All values of tls/ssl must be the same.');\n    }\n  }\n\n  checkTLSOptions(allProvidedOptions);\n\n  const unsupportedOptions = setDifference(\n    allProvidedKeys,\n    Array.from(Object.keys(OPTIONS)).map(s => s.toLowerCase())\n  );\n  if (unsupportedOptions.size !== 0) {\n    const optionWord = unsupportedOptions.size > 1 ? 'options' : 'option';\n    const isOrAre = unsupportedOptions.size > 1 ? 'are' : 'is';\n    throw new MongoParseError(\n      `${optionWord} ${Array.from(unsupportedOptions).join(', ')} ${isOrAre} not supported`\n    );\n  }\n\n  // Option parsing and setting\n\n  for (const [key, descriptor] of Object.entries(OPTIONS)) {\n    const values = allProvidedOptions.get(key);\n    if (!values || values.length === 0) {\n      if (DEFAULT_OPTIONS.has(key)) {\n        setOption(mongoOptions, key, descriptor, [DEFAULT_OPTIONS.get(key)]);\n      }\n    } else {\n      const { deprecated } = descriptor;\n      if (deprecated) {\n        const deprecatedMsg = typeof deprecated === 'string' ? `: ${deprecated}` : '';\n        emitWarning(`${key} is a deprecated option${deprecatedMsg}`);\n      }","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/mongodb/node-mongodb-native/blob/dce7939f86fb283e167ad709955abedb7bf23124/src/connection_string.ts#L351-L387","documentation":"After collecting every URI and object option, the driver computes the set of keys that are not in the known OPTIONS table and rejects them. This catches typos and unsupported options early (fail-fast) rather than silently ignoring them. The message pluralizes 'option(s)' and 'is/are' based on the count.","triggerScenarios":"Any URI query key or options object key that is not a registered driver option. Common: 'sslProtocal', 'maxPoolSize' (renamed), 'reconnectInterval', or vendor-specific keys from another driver.","commonSituations":"Cross-driver config drift (e.g. Java/.NET option names), outdated tutorial snippets, or auto-generated option objects that include extra metadata fields.","solutions":["Check the offending key name against the current driver option list in the docs.","Remove or rename the unsupported key.","If the option exists under a different name (e.g. maxPoolSize -> maxPoolSize is valid; check aliases), update accordingly."],"exampleFix":"// before\nnew MongoClient('mongodb://h/db?maxIdleTimeMS=60000');\n// after\nnew MongoClient('mongodb://h/db?maxIdleTimeMS=60000'); // if valid; otherwise remove/rename per docs","handlingStrategy":"validation","validationCode":"// Keep an allow-list derived from the driver's option names and check keys against it.\nimport { OPTIONS } from './driver-options'; // project-curated list\nfunction assertSupportedOptions(keys: string[]) {\n  const known = new Set(Object.keys(OPTIONS).map(k => k.toLowerCase()));\n  const bad = keys.filter(k => !known.has(k.toLowerCase()));\n  if (bad.length) throw new Error(`Unsupported options: ${bad.join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Type the options object as MongoClientOptions so the compiler rejects unknown keys.","Run driver upgrades with attention to renamed/removed options."],"tags":["connection-string","validation","options","typo"],"backgroundTag":null,"analyzedSha":"dce7939f86fb283e167ad709955abedb7bf23124","analyzedAt":"2026-08-11T04:54:53.215Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}