Gathering detailed insights and metrics for mongoose-helpers-setup-db
Gathering detailed insights and metrics for mongoose-helpers-setup-db
Gathering detailed insights and metrics for mongoose-helpers-setup-db
Gathering detailed insights and metrics for mongoose-helpers-setup-db
a mongoose helper that returns a promised mongoose connection
npm install mongoose-helpers-setup-db
Typescript
Module System
Node Version
NPM Version
64.8
Supply Chain
93.6
Quality
71.8
Maintenance
25
Vulnerability
98.2
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
6 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Jun 19, 2018
Latest Version
0.1.4
Package Id
mongoose-helpers-setup-db@0.1.4
Unpacked Size
50.16 kB
Size
10.80 kB
File Count
30
NPM Version
6.1.0
Node Version
6.14.2
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
3
returns a function that will return a mongoose connection promise when called; it should be used in conjunction with the http-server-request-handlers-db module.
the initial intent of this module is to provide a way to re-initialize a mongoose connection, on an http request, if the connection threw an error, on application startup or was lost after startup.
see the examples directory for an actual implementation using these two modules together.
options.connection.debug
is set to true
the following events will also be logged to the console
db.error
.1npm install mongoose-helpers-setup-db
1/** 2 * @param {Object} user_options 3 * @param {Object} user_options.connection 4 * @param {Array} user_options.schemas 5 * 6 * @returns {Function} 7 */ 8function setupDb( user_options )
1var express = require( 'express' ) 2var connection = require( 'mongoose-helpers-connection' ) 3var mongoose = require( 'mongoose' ) 4var setupDb = require( 'mongoose-helpers-setup-db' ) 5var app = express() 6 7var User = new mongoose.Schema( 8 { 9 displayName: String, 10 email: String, 11 id: String, 12 photo: String 13 } 14) 15 16var options = { 17 connection: { 18 debug: config.debug, 19 uri: { 20 database: config.database, 21 password: config.password, 22 username: config.username 23 } 24 }, 25 schemas: [ 26 { 27 'User': User 28 } 29 ] 30} 31 32setupDb( options ) 33 .then( 34 function ( db ) { 35 app.db = db 36 } 37 ) 38 .catch( 39 function ( err ) { 40 app.db = { 41 error: err 42 } 43 } 44 ) 45 46// elsewhere in your app on a route 47app.db.model( 'User' ) 48 .findOne( 49 { 'id': id }, 50 function( err, existing_user ) { 51 ... 52 } 53 )
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
30 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More