mongodb/node-mongodb-native · error · MongoParseError

Unable to make a writeConcern from journal=${value}

Error message

Unable to make a writeConcern from journal=${value}

What it means

`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.

Source

Thrown at src/connection_string.ts:867

  } as OptionDescriptor,
  heartbeatFrequencyMS: {
    default: 10000,
    type: 'uint'
  },
  ignoreUndefined: {
    type: 'boolean'
  },
  j: {
    deprecated: 'Please use journal instead',
    target: 'writeConcern',
    transform({ name, options, values: [value] }): WriteConcern {
      const wc = WriteConcern.fromOptions({
        writeConcern: {
          ...options.writeConcern,
          journal: getBoolean(name, value)
        }
      });
      if (!wc) throw new MongoParseError(`Unable to make a writeConcern from journal=${value}`);
      return wc;
    }
  } as OptionDescriptor,
  journal: {
    target: 'writeConcern',
    transform({ name, options, values: [value] }): WriteConcern {
      const wc = WriteConcern.fromOptions({
        writeConcern: {
          ...options.writeConcern,
          journal: getBoolean(name, value)
        }
      });
      if (!wc) throw new MongoParseError(`Unable to make a writeConcern from journal=${value}`);
      return wc;
    }
  },
  loadBalanced: {
    default: false,

View on GitHub (pinned to 3366c21a63)

Solutions

  1. Replace `j` with `journal`
  2. Pass a full write concern object: `{ w: 'majority', journal: true }`
  3. Remove the option if journaling is not required

Example fix

// before
new MongoClient(uri, { j: true });
// after
new MongoClient(uri, { journal: true });
Defensive patterns

Strategy: validation

Validate before calling

// j is deprecated; prefer journal.
if ('j' in options) {
  const { j, ...rest } = options;
  options = { ...rest, journal: j };
}

Try / catch

try {
  const client = new MongoClient(uri, options);
} catch (e) {
  if (e instanceof MongoParseError && /writeConcern from journal/.test(e.message)) {
    // consolidate into writeConcern object and retry
  } else throw e;
}

Prevention

When it happens

Trigger: Providing `j` where no valid WriteConcern can be formed; rare malformed write-concern combinations.

Common situations: Legacy configs using `j`; shorthand copied from older tutorials.

Related errors


AI-assisted analysis of mongodb/node-mongodb-native@3366c21a63 (2026-08-04). Data as JSON: /data/errors/ef9ae3cf90144368.json. Report an issue: GitHub.