1602 / jugglingdb

Multi-database ORM for nodejs: redis, mongodb, mysql, sqlite3, postgresql, arango, in-memory...
http://1602.github.io/jugglingdb/
2.04k stars 241 forks source link

ne04j example? #348

Closed ciokan closed 10 years ago

ciokan commented 10 years ago

I'm trying a very simple neo4j example and I can't seem to define a basic model:

var Schema = require('jugglingdb').Schema;
var schema = Schema('neo4j', {
    url: "localhost:7474"
});

var Movie = schema.define('Movie', {
    title: String
}, {
    tableName: 'movies'
});

All I get is this error:

/Users/romeomihalcea/Projects/neomovies/models/user.js:6
var Movie = schema.define('Movie', {
                  ^
TypeError: Cannot call method 'define' of undefined
    at Object.<anonymous> (/Users/romeomihalcea/Dropbox/Projects/neomovies/models/movie.js:6:19)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/romeomihalcea/Dropbox/Projects/neomovies/routes/movie.js:1:79)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
reneolivo commented 10 years ago

Did you try the NEW operator?

var schema = new Schema('neo4j', { url: "localhost:7474" });

ciokan commented 10 years ago

Oh tell me I didn't just do that...problem fixed thank you. That's what you get when you switch languages and projects too fast