{"id":"ef9ae3cf90144368","repo":"mongodb/node-mongodb-native","slug":"unable-to-make-a-writeconcern-from-journal-value","errorCode":null,"errorMessage":"Unable to make a writeConcern from journal=${value}","messagePattern":"Unable to make a writeConcern from journal=(.+?)","errorType":"exception","errorClass":"MongoParseError","httpStatus":null,"severity":"error","filePath":"src/connection_string.ts","lineNumber":867,"sourceCode":"  } as OptionDescriptor,\n  heartbeatFrequencyMS: {\n    default: 10000,\n    type: 'uint'\n  },\n  ignoreUndefined: {\n    type: 'boolean'\n  },\n  j: {\n    deprecated: 'Please use journal instead',\n    target: 'writeConcern',\n    transform({ name, options, values: [value] }): WriteConcern {\n      const wc = WriteConcern.fromOptions({\n        writeConcern: {\n          ...options.writeConcern,\n          journal: getBoolean(name, value)\n        }\n      });\n      if (!wc) throw new MongoParseError(`Unable to make a writeConcern from journal=${value}`);\n      return wc;\n    }\n  } as OptionDescriptor,\n  journal: {\n    target: 'writeConcern',\n    transform({ name, options, values: [value] }): WriteConcern {\n      const wc = WriteConcern.fromOptions({\n        writeConcern: {\n          ...options.writeConcern,\n          journal: getBoolean(name, value)\n        }\n      });\n      if (!wc) throw new MongoParseError(`Unable to make a writeConcern from journal=${value}`);\n      return wc;\n    }\n  },\n  loadBalanced: {\n    default: false,","sourceCodeStart":849,"sourceCodeEnd":885,"githubUrl":"https://github.com/mongodb/node-mongodb-native/blob/3366c21a6311e02f1be91da982f9b93d3cce99a0/src/connection_string.ts#L849-L885","documentation":"`j` is a deprecated alias for `journal`. Its transform (src/connection_string.ts:857-869) routes through `WriteConcern.fromOptions`; if that returns null it throws. Same root cause as the fsync/journal variants.","triggerScenarios":"Providing `j` where no valid WriteConcern can be formed; rare malformed write-concern combinations.","commonSituations":"Legacy configs using `j`; shorthand copied from older tutorials.","solutions":["Replace `j` with `journal`","Pass a full write concern object: `{ w: 'majority', journal: true }`","Remove the option if journaling is not required"],"exampleFix":"// before\nnew MongoClient(uri, { j: true });\n// after\nnew MongoClient(uri, { journal: true });","handlingStrategy":"validation","validationCode":"// j is deprecated; prefer journal.\nif ('j' in options) {\n  const { j, ...rest } = options;\n  options = { ...rest, journal: j };\n}","typeGuard":null,"tryCatchPattern":"try {\n  const client = new MongoClient(uri, options);\n} catch (e) {\n  if (e instanceof MongoParseError && /writeConcern from journal/.test(e.message)) {\n    // consolidate into writeConcern object and retry\n  } else throw e;\n}","preventionTips":["Replace shorthand `j` with `journal`","Keep write-concern settings in one place to avoid conflicts","Use the writeConcern object form for clarity"],"tags":["write-concern","deprecated","configuration"],"analyzedSha":"3366c21a6311e02f1be91da982f9b93d3cce99a0","analyzedAt":"2026-08-04T13:40:15.335Z","schemaVersion":2}