mongoose-session
Advanced tools
Comparing version 0.0.2 to 0.0.3
15
index.js
@@ -6,2 +6,3 @@ var MongooseSession = function (mongoose, options) { | ||
options = options || {}; | ||
options.modelName = options.modelName || 'Session'; | ||
options.ttl = options.ttl || 3600; | ||
@@ -15,3 +16,3 @@ | ||
var sessionSchema = new mongoose.Schema({ | ||
sid: String, | ||
_id: String, | ||
session: mongoose.Schema.Types.Mixed, | ||
@@ -21,3 +22,3 @@ createdAt: (options.ttl ? { type: Date, expires: options.ttl } : Date) | ||
this.SessionModel = mongoose.model('Session', sessionSchema); | ||
this.SessionModel = mongoose.model(options.modelName, sessionSchema); | ||
@@ -27,3 +28,3 @@ this.get = function(sid, callback) { | ||
var self = this; | ||
self.SessionModel.findOne({ sid: sid }) | ||
self.SessionModel.findOne({ _id: sid }) | ||
.exec(function(err, results) { | ||
@@ -46,4 +47,4 @@ if (err) { | ||
self.SessionModel.update( | ||
{ sid: sid }, | ||
{ sid: sid, session: session, createdAt: new Date() }, | ||
{ _id: sid }, | ||
{ _id: sid, session: session, createdAt: new Date() }, | ||
{ upsert: true }, | ||
@@ -62,3 +63,3 @@ function(err) { | ||
var self = this; | ||
self.SessionModel.remove({ sid: sid }) | ||
self.SessionModel.remove({ _id: sid }) | ||
.exec(function(err, results) { | ||
@@ -103,2 +104,2 @@ if (err) { | ||
return new MongooseSession(mongoose, options); | ||
}; | ||
}; |
{ | ||
"name": "mongoose-session", | ||
"version": "0.0.2", | ||
"author": "Chance Dickson <chance@chardev.se> (http://chardev.se)", | ||
"version": "0.0.3", | ||
"author": "Chance Dickson <me@chncdcksn.com> (http://chncdcksn.com)", | ||
"main": "./index.js", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/TheRealCharDev/mongoose-session.git" | ||
"url": "git://github.com/chncdcksn/mongoose-session.git" | ||
}, | ||
"dependencies": { | ||
"express-session": "~1.7.6" | ||
"express-session": "~1.8.2" | ||
} | ||
} | ||
} |
@@ -29,5 +29,6 @@ # mongoose-session | ||
* `options.ttl` : allowed time of inactivity before a session is destroyed, in seconds (3600) | ||
* `options.modelName` : specifies the name of the collection, defaults to 'Session' | ||
## Info | ||
This works perfectly for my current use in projects, and requires no configuration. If your usage of mongoose-session would require any extra configuration to work properly, feel free to submit an issue or pull request, and I'll look over it and make any changes needed to be made for this to work for everyone. :) | ||
This works perfectly for my current use in projects, and requires no configuration. If your usage of mongoose-session would require any extra configuration to work properly, feel free to submit an issue or pull request, and I'll look over it and make any changes needed to be made for this to work for everyone. :) |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5596
90
34
1
+ Addedcookie-signature@1.0.5(transitive)
+ Addedcrc@3.0.0(transitive)
+ Addeddebug@2.0.0(transitive)
+ Addeddepd@0.4.5(transitive)
+ Addedexpress-session@1.8.2(transitive)
- Removedbuffer-crc32@0.2.3(transitive)
- Removedcookie-signature@1.0.4(transitive)
- Removeddebug@1.0.4(transitive)
- Removeddepd@0.4.4(transitive)
- Removedexpress-session@1.7.6(transitive)
Updatedexpress-session@~1.8.2