node-sync icon indicating copy to clipboard operation
node-sync copied to clipboard

Error using mongoose

Open ysilvela opened this issue 10 years ago • 1 comments

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) {

ysilvela avatar Dec 11 '15 11:12 ysilvela

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

talha-asad avatar Jan 15 '16 17:01 talha-asad