ybogdanov / node-sync

Write simple and readable synchronous code in nodejs using fibers
MIT License
491 stars 70 forks source link

Error using mongoose #49

Open ysilvela opened 8 years ago

ysilvela commented 8 years ago

I'm using mongoose to query mongodb from nodejs and I obtain next error when query a document:

2015-12-11T08:56:13.381Z - error: uncaughtException: Cannot read property 'discriminatorMapping' of undefined

The line of code thats thwows error:

User.findOne.sync({id_company: id_c}, function(err, usr) {

talha-asad commented 8 years ago

You forgot to give first parameter, which is context this, in your case maybe try passing it User. The signature of .sync functions is similar to .call