ExportXMLWordPrintableJSON

    • 2
    • 2
    • Not Needed
    • None
    • 1
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a Node.js driver user,
      I want zstd compression to use the built-in zstd support in Node.js,
      so that I don't have to install additional npm packages for zstd compression to work.

      User Experience

      • On Node.js 22.15.0+ the driver uses the built-in zlib.zstdCompress / zlib.zstdDecompress. No @mongodb-js/zstd install is needed.
      • On older Node.js versions the driver falls back to @mongodb-js/zstd, so existing setups keep working without changes.
      • If neither is available, the MongoMissingDependencyError message now says that built-in zstd needs Node.js 22.15.0 or later and that @mongodb-js/zstd is the alternative.

      Dependencies

      Risks/Unknowns

      • Built-in and addon output must stay interoperable, since the server and other clients decompress either one. Covered by tests in both directions.
      • Compression level is passed through zlib.constants.ZSTD_c_compressionLevel. When no level is given, the built-in default is used.

      Acceptance Criteria

      Implementation Requirements

      • getZstdLibrary() in src/deps.ts prefers the Node.js built-in implementation when both zlib.zstdCompress and zlib.zstdDecompress exist.
      • Falls back to @mongodb-js/zstd when the built-in is unavailable.
      • Precedence decision: the built-in wins when both are present.

      Testing Requirements

      • Data compressed by the built-in is decompressed by @mongodb-js/zstd, and the other way around.
      • The built-in is preferred when both are present.
      • The compression level is passed to the built-in implementation.
      • Falls back to @mongodb-js/zstd when the built-in is unavailable.

      Documentation Requirements

      • README optional-dependencies list notes that @mongodb-js/zstd is only needed on Node.js earlier than 22.15.0.

      Follow Up Requirements

      • N/A

            Assignee:
            Sergey Zelenov
            Reporter:
            Anna Henningsen
            Sean Milligan
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: