title: NodeJS, ExpressJS & PassportJS Sessions on Cloud9 connecting to Appfog Mongo
body: <p>I'm having great difficulty getting any sort of connection to MongoDB on Appfog for session storage working.  I'm currently running Node Express with PassportJS and Mongoose.  I've followed numerous examples and tutorials online and tried a few ODM mappers.</p>
  
  <p>I must confess, I've struggled to get any sort of connection let alone, the abstracted sessions stuff working.</p>
  
  <p>I've tried the SO examples <a href="https://stackoverflow.com/questions/14995336/how-to-get-mongodb-working-on-appfog">here</a> and <a href="https://stackoverflow.com/questions/10661981/cloud9-mongodb-nodejs">here</a> without success. Everytime I attempt to connect with the following code:-</p>
  
  <pre><code>var env = process.env.NODE_ENV || 'development',
      config = require('./config/config')[env],
      auth = require('./config/middlewares/authorization'),
      mongoose = require('mongoose');
  
  // Bootstrap db connection
  mongoose.connect(config.db);
  </code></pre>
  
  <p>I get a:-</p>
  
  <pre><code>Error: Error setting TTL index on collection : sessions
      at module.exports._get_collection (/var/lib/stickshift/514a22705973cafc85000110/app-root/data/447240/node_modules/connect-mongo/lib/connect-mongo.js:137:23)
      at Db.ensureIndex (/var/lib/stickshift/514a22705973cafc85000110/app-root/data/447240/node_modules/mongodb/lib/mongodb/db.js:1227:28)
      at Db.indexInformation (/var/lib/stickshift/514a22705973cafc85000110/app-root/data/447240/node_modules/mongodb/lib/mongodb/db.js:1371:30)
  </code></pre>
  
  <p>Can anyone offer any possible direction or help to get this working please?</p>
  
  <p>Please ask if you need further dumps of the code here to aid a solution.</p>
  
  <p>Help appreciated.</p>