mongoose and q promises mongoose and q promises mongoose mongoose

mongoose and q promises


Because the methods you're nfbinding are methods of the user object, you need to bind them to that object before passing them to nfbind so that the this pointer is preserved when called.

This approach worked for me:

exports.user.find = Q.nfbind(user.find.bind(user));exports.user.findOne = Q.nfbind(user.findOne.bind(user));