Some helper functions for mongoose.
npm install @sqrtthree/mongoose-helper
const { makeConnectionURI } = require('@sqrtthree/mongoose-helper')
// Or with esm
import { makeConnectionURI } from '@sqrtthree/mongoose-helper'
Format options to standard connection string of the MongoDB. Connection String URI Format
The host where the mongod instance is running.
Optional. The port number where the mongod instance is running.
The host (and optional port number) where the mongos instance for a sharded cluster is running.
- For a replica set, specify the hostname(s) of the mongod instance(s) as listed in the replica set configuration.
- For a sharded cluster, specify the hostname(s) of the mongos instance(s).
The authentication database to use if the connection string includes username:password@ authentication credentials but the authSource option is unspecified.
Optional. Authentication credentials.
Optional. Authentication credentials.
Optional. A query string that specifies connection specific options as <name>=<value>
pairs.
sqrtthree.com · GitHub @sqrthree · Twitter @sqrtthree