dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 376 forks source link

Always return undefined - ExpressJS #676

Closed dm67x closed 8 years ago

dm67x commented 8 years ago

I use recently ORM package to manage my database. I made this on app.js :

app.use(orm.express("mysql://........", { define: function(db, models, next) { models.user = db.define("user", { nom: String, prenom: String, addr_mail: String, mdp: String, num_telephone: Number, points: Number }); next(); } }));

But when I use req.models.user.find({addr_mail: req.body.mail}, function....) on my routes/users.js it always return undefined.

I think the problem comes from me.