{"id":18441587,"url":"https://github.com/stefanwalther/mongoose-connection-config","last_synced_at":"2025-10-25T10:42:18.892Z","repository":{"id":29703725,"uuid":"122483989","full_name":"stefanwalther/mongoose-connection-config","owner":"stefanwalther","description":"Helper library to set mongoose configurations.","archived":false,"fork":false,"pushed_at":"2025-08-22T22:49:29.000Z","size":98,"stargazers_count":1,"open_issues_count":15,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-24T01:26:42.896Z","etag":null,"topics":["library","mongodb","mongoose"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stefanwalther.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-02-22T13:44:00.000Z","updated_at":"2023-02-01T21:25:03.000Z","dependencies_parsed_at":"2024-05-09T15:49:47.836Z","dependency_job_id":"3fa79531-283f-4d9c-911e-af8022e9d095","html_url":"https://github.com/stefanwalther/mongoose-connection-config","commit_stats":{"total_commits":106,"total_committers":5,"mean_commits":21.2,"dds":0.4339622641509434,"last_synced_commit":"11d61ed12da2454fdc2d998cdcb4e51b63f8af0b"},"previous_names":["stefanwalther/mongoose-config"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/stefanwalther/mongoose-connection-config","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanwalther%2Fmongoose-connection-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanwalther%2Fmongoose-connection-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanwalther%2Fmongoose-connection-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanwalther%2Fmongoose-connection-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanwalther","download_url":"https://codeload.github.com/stefanwalther/mongoose-connection-config/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanwalther%2Fmongoose-connection-config/sbom","scorecard":{"id":368861,"data":{"date":"2025-08-11","repo":{"name":"github.com/stefanwalther/mongoose-connection-config","commit":"d276328571399edc0a3986af2635ab5bfc4005b8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 0/9 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-18T12:30:47.086Z","repository_id":29703725,"created_at":"2025-08-18T12:30:47.086Z","updated_at":"2025-08-18T12:30:47.086Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272858542,"owners_count":25005092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","mongodb","mongoose"],"created_at":"2024-11-06T06:38:40.705Z","updated_at":"2025-10-25T10:42:18.826Z","avatar_url":"https://github.com/stefanwalther.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mongoose-connection-config\n\n[![npm](https://img.shields.io/npm/v/mongoose-connection-config.svg)]()\n[![CircleCI](https://img.shields.io/circleci/project/github/stefanwalther/mongoose-connection-config.svg)](https://circleci.com/projects/gh/stefanwalther/mongoose-connection-config)\n[![Codecov](https://img.shields.io/codecov/c/github/stefanwalther/mongoose-connection-config.svg)](https://codecov.io/gh/stefanwalther/mongoose-connection-config)\n\n\u003e Helper library to set mongoose connection configuration.\n\n---\n\n## Installation\n\n```\n$ npm install mongoose-connection-config --save\n```\n\n## Usage\n\n### Build the connection string\n\n```js\nconst MongooseConnectionConfig = require('mongoose-connection-config');\n\nconst opts = {\n  host: process.env.MONGO_HOST || 'localhost',\n  port: process.env.MONGO_PORT || 27017,\n  database: 'my-db'\n};\nconst mcc = new MongooseConnectionConfig(opts);\n\nconsole.log(mcc.getMongoUri()); // =\u003e mongodb://localhost:27017/my-db\n```\n\n### Override the connection string\n\nIf you want to ignore all options being passed in, then set the option `connection_string`, this value will then be returned, building the connection string will be skipped.\n\n```js\n\nconst MongooseConnectionConfig = require('mongoose-connection-config');\n\nconst opts = {\n  connection_string: 'mongodb+srv://dbUser:dbPassword@cluster-fra.mongodb.net/test?retryWrites=true\u0026w=majority',\n  host: process.env.MONGO_HOST || 'localhost',\n  port: process.env.MONGO_PORT || 27017,\n  database: 'my-db'\n};\nconst mcc = new MongooseConnectionConfig(opts);\n\nconsole.log(mcc.getMongoUri()); // =\u003e mongodb+srv://dbUser:dbPassword@cluster-fra.mongodb.net/test?retryWrites=true\u0026w=majority\n\n```\n\n## API\n\n### [MongooseConnectionConfig](src/index.js#L10)\n\n### [Configuration](src/index.js#L53)\nDefine a configuration object to pass to the constructor.\n\nIf no options are defined, the default options will be used:\nSee [index.js =\u003e DEFAULT_CONFIGURATION](index.js) for more information about the current default options.\n\n**Params**\n\n* `opts` **{Object}**: Options to pass in.    \n* **{String}**: `opts.connection_string - Full connection string which will then be returned, ignoring all other options.    \n* `opts.debug` **{Boolean}**: Whether MongoDB runs in debug mode or not.    \n* `opts.host` **{String}**: The MongoDBhost, defaults to `localhost`.  See the mongodb [connection string spec](https://docs.mongodb.com/manual/reference/connection-string/) for more details.    \n* `opts.port` **{Number}**: The MongoDB port, defaults to `27017`.  See the mongodb [connection string spec](https://docs.mongodb.com/manual/reference/connection-string/) for more details.    \n* `opts.database` **{String}**: The MongoDB database, defaults to `admin`.  See the mongodb [connection string spec](https://docs.mongodb.com/manual/reference/connection-string/) for more details.    \n* `opts.connectOptions` **{Object}**: The MongoDB connection properties, being passed through to the native MongoDB driver. See [mongoose' documentation](http://mongoosejs.com/docs/connections.html), resp. [MongoDB's native driver for node.js' documentation](https://github.com/mongodb/node-mongodb-native) for more details.    \n\n**Example**\n\n```js\n// Default Options:\nconst defaultOpts = {\n   debug: false,\n   host: 'localhost',\n   port: 27017,\n   database: '',\n   connectOptions: {\n     db: {},\n     server: {\n       auto_reconnect: true\n     },\n     replset: {},\n     user: {},\n     pass: {},\n     auth: {},\n     mongos: {}\n   }\n};\n```\n\n### [.constructor()](src/index.js#L77)\nInitialize a new MongooseConnectionConfig.\n\nBasic Example:\n\n**Params**\n\n* **{Configuration}**: config - Configuration options overriding the default ones.    \n\n**Example**\n\n```js\nconst MongooseConnectionConfig = require('./src');\n\nconst opts = {\n  host: process.env.MONGO_HOST || 'localhost',\n  port: process.env.MONGO_PORT || 27017,\n  database: 'my-db'\n};\nconst mcc = new MongooseConnectionConfig(opts);\n\nconsole.log(mcc.getMongoUri()); // =\u003e mongodb://localhost:27017/my-db   *\n```\n\nExample:\n\n* `returns` **{Object}**  \n\n**Example**\n\n```js\nconst MongooseConnectionConfig = require('./../src');\n\nlet mongooseConnectionConfig = new MongooseConnectionConfig();\nconsole.log(mongooseConnectionConfig.DEFAULT_CONFIG);\n```\n\nGet the connection string.\n\n* `returns` **{string}**  \n\n## Author\n**Stefan Walther**\n\n* [github.com/stefanwalther](http://github.com/stefanwalther) \n* [twitter](http://twitter.com/waltherstefan)  \n\n## License\nMIT\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 01, 2019._\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanwalther%2Fmongoose-connection-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanwalther%2Fmongoose-connection-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanwalther%2Fmongoose-connection-config/lists"}