Skip to content

Instantly share code, notes, and snippets.

@AshHeskes
Created March 18, 2011 14:28
Show Gist options
  • Save AshHeskes/876157 to your computer and use it in GitHub Desktop.
Save AshHeskes/876157 to your computer and use it in GitHub Desktop.
user = require('./models.js').user(db);
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
mongoose.connect('mongodb://ashmokhberi:<pwrd>@flame.mongohq.com:27066/cloudmarkup-dev');
var userInfo = new Schema({
'userName': String,
'email': { type: String, validate: '\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b', },
'password': String,
'signupDate': Date,
'lastLogin': Date,
'salt': String
});
var user = new Schema({
'user': userInfo
});
mongoose.model('user', user)
exports.user = function(db) {
return db.model('user')
};
node.js:116
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: undefined is not a function
at CALL_NON_FUNCTION_AS_CONSTRUCTOR (native)
at Schema.path (/usr/local/lib/node/.npm/mongoose/1.1.0/package/lib/mongoose/schema.js:139:24)
at Schema.add (/usr/local/lib/node/.npm/mongoose/1.1.0/package/lib/mongoose/schema.js:106:12)
at new Schema (/usr/local/lib/node/.npm/mongoose/1.1.0/package/lib/mongoose/schema.js:38:10)
at Object.<anonymous> (/home/ash/Sites/cloudmarkup/models.js:16:12)
at Module._compile (module.js:383:26)
at Object..js (module.js:389:10)
at Module.load (module.js:315:31)
at Function._load (module.js:276:12)
at require (module.js:327:19)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment