Skip to content

Instantly share code, notes, and snippets.

@abi
Created October 13, 2010 22:10
Show Gist options
  • Save abi/625043 to your computer and use it in GitHub Desktop.
Save abi/625043 to your computer and use it in GitHub Desktop.
//I am trying to use Mongoose to put http://acabee.org on MongoDB. Mongoose looks great but I'm getting an error.
mongoose.model('Boo', {
properties: ['first', 'last', 'age']
});
var db = mongoose.connect('mongodb://localhost/db');
var Boo = db.model('Boo');
debug(Boo);
var u = new Boo({first: 'John', last: 'Doe', age: 18}); <- Error on this line because Boo is not a function apparently
u.save(function(){
console.log('Saved!');
});
// I get this error:
TypeError: undefined is not a function
at CALL_NON_FUNCTION_AS_CONSTRUCTOR (native)
at [object Object].<anonymous> (/Users/abiraja/Stuff/acabee/lib/vendor/lib/model.js:13:22)
at [object Object].Class (/Users/abiraja/Stuff/acabee/lib/vendor/lib/util.js:127:19)
at Object.<anonymous> (/Users/abiraja/Stuff/acabee/project/app.js:142:9)
at Module._compile (node.js:662:23)
at Module._loadScriptSync (node.js:669:10)
at Module.loadSync (node.js:538:12)
at Object.runMain (node.js:722:24)
at Array.<anonymous> (node.js:745:12)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment