Giter VIP home page Giter VIP logo

connect-session-mongo's People

Contributors

bartt avatar davglass avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

connect-session-mongo's Issues

Performance: Index by session id

In my dev environment, I have noticed warnings in my mongodb logs about a long-running query by _sessionId. This field is not indexed in the database, thus the entire collection has to be scanned. Granted, I could simply add an index. But why doesn't the software either enforce a unique index on _sessionId or store the session id in the _id field?

The _id field seems to be the most logical because it would avoid redundant data and it's guaranteed to be indexed. Performance aside, session id IS the unique id of a session object, so it makes sense semantically as well.

Excerpt from my mongodb server log.

Fri Aug 10 21:50:42 [conn25] query connect-sessions.sessions query: { _sessionid: "ArpwSnnfVozbOjdjpSh1HgIm.yLgebBiaNbTZWZ3I/sNanaCcq0zafccHWML9eTM4Ibk" } ntoreturn:1 nscanned:9 nreturned:1 reslen:453 967ms

In pair with the latests mongoose 3.2.2 shows "Please ensure that you set the default safe variable" warning

Full warning text, displayed on new MongoStore() call:

========================================================================================
=  Please ensure that you set the default safe variable to one of the                  =
=   allowed values of [true | false | {j:true} | {w:n, wtimeout:n} | {fsync:true}]     =
=   the default value is false which means the driver receives does not                =
=   return the information of the success/error of the insert/update/remove            =
=                                                                                      =
=   ex: new Db(new Server('localhost', 27017), {safe:false})                           =
=                                                                                      =
=   http://www.mongodb.org/display/DOCS/getLastError+Command                           =
=                                                                                      =
=  The default of false will change to true in the near future                         =
=                                                                                      =
=  This message will disappear when the default safe is set on the driver Db           =
========================================================================================

Connection is configured in the following way: mongo = require('mongoose').connect(MONGO_DB, {db: {safe: false}})

Maximum call stack size exceeded

I have bad news I'm testing your application or em good mix of your aplicaicón improved .... But now I am showing

[ERROR] RangeError
[RangeError: Maximum call stack size exceeded]

"ReferenceError: fn is not defined" when calling sessionStore.clear/all

The error is thrown at /connect-session-mongo.js:128

fn && fn();

The problem is that the clear method takes no arguments, when it should take the fn argument as a callback to be notified after removal or in case of error.
The problem is easily solved by adding the fn argument to the clear method. In connect-session-mongo.js:125:

MongoStore.prototype.clear = function() {

becomes

MongoStore.prototype.clear = function(fn) {

The same applies to the all method, with the same solution; the other methods seem ok, but i didn't test them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.