Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sessionstore

Package Overview
Dependencies
Maintainers
2
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sessionstore - npm Package Compare versions

Comparing version 1.2.13 to 1.2.14

55

lib/databases/mongodb.js

@@ -66,33 +66,37 @@ 'use strict';

var server;
var connectionUrl;
if (options.servers && Array.isArray(options.servers)){
var servers = [];
if (options.url) {
connectionUrl = options.url;
} else {
var members = options.servers
? options.servers
: [{host: options.host, port: options.port}];
options.servers.forEach(function(item){
if(item.host && item.port) {
servers.push(new mongo.Server(item.host, item.port, item.options));
}
});
var memberString = _(members).map(function(m) { return m.host + ':' + m.port });
var authString = options.username && options.password
? options.username + ':' + options.password + '@'
: '';
var optionsString = options.authSource
? '?authSource=' + options.authSource
: '';
server = new mongo.ReplSet(servers);
} else {
server = new mongo.Server(options.host, options.port, options.options);
connectionUrl = 'mongodb://' + authString + memberString + '/' + options.dbName + optionsString;
}
this.db = new mongo.Db(options.dbName, server, { safe: true });
this.db.on('close', function() {
self.isConnected = false;
self.emit('disconnect');
self.stopHeartbeat();
});
var client = new mongo.MongoClient();
this.isConnected = false;
this.db.open(function (err, client) {
client.connect(connectionUrl, options.options, function(err, db) {
if (err) {
if (callback) callback(err);
} else {
self.db = db;
self.db.on('close', function() {
self.isConnected = false;
self.emit('disconnect');
self.stopHeartbeat();
});
var finish = function (err) {
self.client = client;
self.sessions = self.db.collection(options.collectionName);

@@ -111,10 +115,3 @@ self.sessions.ensureIndex({ expires: 1 }, { expireAfterSeconds: 0 }, function() {});

if (options.authSource && options.username) {
// Authenticate with authSource
client.authenticate(options.username, options.password, {authSource: options.authSource}, finish);
} else if (options.username) {
client.authenticate(options.username, options.password, finish);
} else {
finish();
}
finish();
}

@@ -121,0 +118,0 @@ });

{
"author": "adrai",
"name": "sessionstore",
"version": "1.2.13",
"version": "1.2.14",
"private": false,

@@ -6,0 +6,0 @@ "main": "index.js",

@@ -42,2 +42,3 @@ # Introduction

// password: 'secret' // optional
// url: 'mongodb://user:pass@host:port/db?opts // optional
})

@@ -44,0 +45,0 @@ }));

@@ -0,1 +1,4 @@

### [v1.2.14](https://github.com/adrai/sessionstore/compare/v1.2.13...v1.2.14)
- Support mongo connection string
### [v1.2.13](https://github.com/adrai/sessionstore/compare/v1.2.12...v1.2.13)

@@ -2,0 +5,0 @@ - redis, mongodb: call disconnect on ping error

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