Guest User

Untitled

a guest
Jul 18th, 2018
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1.  
  2. app.configure(function(){
  3. app.set('db-uri','mongodb://xxxx:xxxx@dbh00.mongolab.com:27007/testing');
  4. // ...
  5. });
  6.  
  7. db = mongoose.connect(app.set('db-uri'));
  8. var mongo_connection_details = { dbname: db.db.databaseName,
  9. host: db.db.serverConfig.host,
  10. port: db.db.serverConfig.port,
  11. username: db.uri.username,
  12. password: db.uri.password,
  13. collection: "sessions"};
  14.  
  15. // mongo session store
  16. app.use(express.session({store: mongoStore(mongo_connection_details)}));
  17.  
  18.  
  19. // using all the latest version of connect-mongodb, express and mongodb driver and mongoose.
  20.  
  21. // works very well locally, but using mongolab or mongohq it hangs when it tries to write the session
Add Comment
Please, Sign In to add comment