A JavaScript library for modeling MongoDB connection URIs and options. Version 22.4.1 provides a structured way to parse, validate, and serialize connection strings for the MongoDB Node.js driver. Maintained as part of the MongoDB Compass project, it aligns with driver version 5.x and validates options like TLS, authentication, and read preferences. The model converts between URI strings and objects, offering detailed validation error messages. It is released sporadically alongside Compass releases, with a focus on correctness and compatibility with the official driver.
npm install mongodb-connection-modelNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses a MongoDB URI into a ConnectionModel, modifies options, validates, and serializes back to a URI.
Use import syntax or switch to CommonJS version (21.x or earlier).
Update mongodb to ^5.5.0 or later.
Use model.auth = { user: '...', password: '...' } instead.Call model.validate() before toConnectionString() to ensure consistency.
Manually verify ns format or use dedicated validation.
Use import { ConnectionModel } from 'mongodb-connection-model';Run npm install mongodb@^5.5.0