Gloorian

db.js

Feb 3rd, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var mongoose = require('mongoose'),
  2.     Schema = mongoose.Schema;
  3.  
  4. module.exports = function () {
  5.  mongoose.connect('mongodb://localhost/test',
  6.     function(err) {
  7.         if (err) { throw err; }
  8.     }
  9.  );
  10. };
  11.  
  12. var User = new Schema({
  13.     username: {type: String, index: { unique: true }},
  14.     mdp: String    
  15. });
  16.  
  17. module.exports = mongoose.model('User', User);
Advertisement
Add Comment
Please, Sign In to add comment