mongoose.connect giving error in nodejs

I am using node to connect to mongoose database, but when i run the code, it gives error as:

Uncaught TypeError: undefined is not a function
  (anonymous function)  server.js:13

Below is the code which i am running in server.js

var express= require(['express']);
var bodyParser = require(['body-parser']);
var cookieParser = require(['cookie-parser']);
var expressSession = require(['express-session']);
var mongoose = require(['mongoose']);

var mongoStore = require(['connect-mongo'])({session: expressSession});
require(['./models/users.js']);
mongoose.connect('mongodb://localhost/userregistration');
var app = express();
app.engine('.html', require('ejs').__express);
app.set('views',__dirname + '/views');
app.set('view engine','html');

app.use(bodyParser());
app.use(cookieParser());
app.use(expressSession({
    secret: 'SECRET',
    cookie: {maxAge:60*60*1000 },
    store: new mongoStore({
        db: mongoose.connection.db,
        collection: 'sessions'
    })

}));

require('./routes')(app);
app.listen(80);

looking at the logs, the code is giving the error at:

mongoose.connect('mongodb://localhost/userregistration');

I think you forgot to require express-session.

Here is the example

ExpressSession

app.use(express.session({
  secret: 'SECRET',
  cookie: {maxAge:60*60*1000 },
  store: new mongoStore({
    db: mongoose.connection.db,
    collection: 'sessions'
  })
}));

connect-mongo has a special option for using Mongoose connections, try using that:

store: new mongoStore({
    mongoose_connection: mongoose.connection,
    collection: 'sessions'
})

If that doesn't fix it, please post more information (like a full stack trace and the actual code you're running, since those require's don't look right).