edwardhotchkiss / mongoose-paginate

Mongoose.js (Node.js & MongoDB) Document Query Pagination
MIT License
984 stars 218 forks source link

Promise resolver undefined is not a function #96

Open gitawego opened 7 years ago

gitawego commented 7 years ago

the module throws error because of misuse of Promise.

Promise can not be instantiated without params.

at line 92 in index.js, instead of

let promise = new Promise();
promise.resolve(result);
return promise;

it should be

return Promise.resolve(result);

or return directly the result

fiznool commented 7 years ago

@gitawego there are many issues with the current version on npm. I've just pushed a PR #95 to fix the issues. In the meantime you can use my branch which includes these fixes:

npm install fiznool/mongoose-paginate