Skip to content

Instantly share code, notes, and snippets.

@deepaksinghvi
Created March 28, 2012 17:22
Show Gist options
  • Save deepaksinghvi/2228405 to your computer and use it in GitHub Desktop.
Save deepaksinghvi/2228405 to your computer and use it in GitHub Desktop.
Create a model
models.createModels(mongoose, function() {
app.TestUser = TestUser = mongoose.model('TestUser');
db = mongoose.connect('mongodb://localhost/testdb');
console.log("Database Started");
})
function createModels(mongoose, fn) {
var Schema = mongoose.Schema;
/**
* Model: TestUser
*/
TestUser = new Schema({
'username': String,
'password': String,
});
mongoose.model('TestUser', TestUser);
fn();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment