New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

connect2mongo

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect2mongo - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

11

db.js

@@ -10,7 +10,8 @@ var BPromise = require('bluebird');

* @param {String} db MongoDB Database
* @param {Object} auth An object containing User Authentication information {user: 'user1', password: 'pass'}
* @param {String} username The Username for authentication
* @param {String} password The Password for authentication
* @resolve {Object} database A MongoDB Connection Instance
* @reject {Error} err The Error Object
*/
exports.connect = function (host, port, db, auth) {
exports.connect = function (host, port, db, username, password) {
var fallback = function (value, fallback) {

@@ -20,5 +21,5 @@ return value || fallback;

var genUser = function (auth) {
if (auth.user && auth.pas) {
return fallback(auth.user) + ':' + fallback(auth.password) + '@';
var genUser = function (username, password) {
if (username && password) {
return fallback(username) + ':' + fallback(password) + '@';
} else {

@@ -25,0 +26,0 @@ return false;

{
"name": "connect2mongo",
"version": "0.0.2",
"version": "0.0.3",
"description": "A library to help you connect to mongodb",

@@ -5,0 +5,0 @@ "main": "db.js",

@@ -6,2 +6,22 @@ var BPromise = require('bluebird');

* @param {String} database A MongoDB Connection Instance
* @param {String} username The Username for authentication
* @param {String} password The Password for authentication
* @resolve {Object} result The authentication's result
* @reject {Error} err The Error Object
*/
exports.authenticate = function (database, username, password, options) {
return new BPromise(function (resolve, reject) {
db.authenticate(username, password, options, function (err, result) {
if (err) {
reject(err);
} else {
resolve(result);
}
});
});
};
/**
* Get all the Documents of a MongoDB Collection
* @param {String} database A MongoDB Connection Instance
* @param {String} collection The MongoDB Collection name

@@ -8,0 +28,0 @@ * @resolve {Array} documents The Documents of that collection

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc