connect-mongo vs connect-mongodb #29

Closed
TechplexEngineer opened this Issue Dec 30, 2012 · 1 comment

2 participants

@TechplexEngineer

for some reason i seem to be getting this error [1] on starting a copy of this app. I tracked it down to
this bit of code in config/express.js

app.use(express.session({
      secret: 'noobjs',
      store: new mongoStore({
        url: config.db,
        collection : 'sessions'
      })
    }))

looking at the mongoStore variable in config/express.js higher in the code we find:

  , mongoStore = require('connect-mongodb')

[2]^^

I can't seem to figure out what the difference between connect-mongo and connect-mongodb. If I change the module used in the project to from connect-mongodb to connect-mongo the nasty error [1] goes away. From what I've been able to find the two are forks of each other, with connect-mongo being more heavily updated. Is there a reason for choosing one over the other?

If not, I would propose changing to connect-mongo as it seems to be used more and is updated more recently, and it doesn't produce that error [1].

To change simply replace [2] in `config/express.js with this:

  , mongoStore = require('connect-mongo')(express)

as well as in the package.json

[1]

========================================================================================
=  Please ensure that you set the default write concern for the database by setting    =
=   one of the options                                                                 =
=                                                                                      =
=     w: (value of > -1 or the string 'majority'), where < 1 means                     =
=        no write acknowlegement                                                       =
=     journal: true/false, wait for flush to journal before acknowlegement             =
=     fsync: true/false, wait for flush to file system before acknowlegement           =
=                                                                                      =
=  For backward compatibility safe is still supported and                              =
=   allows 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 no acknowlegement will change in the very near future                =
=                                                                                      =
=  This message will disappear when the default safe is set on the driver Db           =
========================================================================================```
@madhums madhums added a commit that closed this issue Dec 30, 2012
@madhums fix #29 a32820a
@madhums madhums closed this in a32820a Dec 30, 2012
@madhums
Owner

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment