
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
mongodb-connection-model
Advanced tools
MongoDB connection model.
npm install --save mongodb-connection-model
var Connection = require('mongodb-connection-model');
hostname (optional, String) ... Hostname of a MongoDB Instance [Default: localhost].port (optional, Number) ... TCP port of a MongoDB Instance [Default: 27017].name (optional, String) ... User specified name [Default: My MongoDB].instance_id (String) ... The mongoscope instance_id [Default: localhost:27017].driver_url (String) ... The first argument mongoscope-server passes to mongodb.connect [Default: mongodb://localhost:27017/?slaveOk=true].driver_options (Object) ... The second argument mongoscope-server passes to mongodb.connect [Default: {}].It's useful to think of the remaining properties as two primary traits: authentication and ssl.
authentication (optional, String) ... The desired authetication strategy [Default: NONE]
NONE Use no authentication.MONGODB Allow the driver to auto-detect and select SCRAM-SHA-1 or MONGODB-CR depending on server capabilities.KERBEROSX509LDAPvar model = new Connection({
authentication: 'NONE'
});
console.log(model.driver_url);
>>> 'mongodb://localhost:27017?slaveOk=true'
console.log(new Connection().driver_url);
>>> 'mongodb://localhost:27017?slaveOk=true'
mongodb_username (required, String)mongodb_password (required, String)mongodb_database_name (optional, String) [Default: admin]var model = new Connection({
authentication: 'MONGODB',
mongodb_username: 'arlo',
mongodb_password: 'B@sil'
});
console.log(model.driver_url);
>>> 'mongodb://arlo:B%40sil@localhost:27017?slaveOk=true&authSource=admin'
kerberos_principal (required, String) ... The format of a typical Kerberos V5 principal is primary/instance@REALM.kerberos_password (optional, String) ... [Default: undefined].kerberos_service_name (optional, String) ... [Default: mongodb].node.js driver Kerberos reference
var model = new Connection({
authentication: 'KERBEROS',
kerberos_principal: 'arlo@MONGODB.PARTS'
});
console.log(model.driver_url);
>>> 'mongodb://arlo%2540MONGODB.PARTS@localhost:27017/kerberos?slaveOk=true&gssapiServiceName=mongodb&authMechanism=GSSAPI'
@note (imlucas): Broken out as it's own state for UX consideration.
var model = new Connection({
authentication: 'KERBEROS',
kerberos_principal: 'arlo/admin@MONGODB.PARTS',
kerberos_password: 'B@sil',
kerberos_service_name: 'MongoDB'
});
console.log(model.driver_url);
>>> 'mongodb://arlo%252Fadmin%2540MONGODB.PARTS:B%40sil@localhost:27017/kerberos?slaveOk=true&gssapiServiceName=MongoDB&authMechanism=GSSAPI'
Note: Not to be confused with
authentication=X509.
ssl (optional, String) ... The desired ssl strategy [Default: NONE]
NONE No SSL.UNVALIDATED No validation of certificate chain.SERVER Driver should validate Server certificate.ALL Driver should validate Server certificate and present valid Certificate.Do not use SSL for anything.
Use SSL but do not perform any validation of the certificate chain.
The driver should validate the server certificate and fail to connect if validation fails.
The driver must present a valid certificate and validate the server certificate.
| authentication:ssl | NONE | UNVALIDATED | SERVER | ALL |
|---|---|---|---|---|
| NONE | ||||
| MONGODB | ||||
| KERBEROS | ||||
| KERBEROS_WINDOWS | ||||
| X509 | ||||
| LDAP |
npm test
Apache 2.0
FAQs
MongoDB connection model
We found that mongodb-connection-model demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 34 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.