Skip to content

Commit

Permalink
fix findById
Browse files Browse the repository at this point in the history
  • Loading branch information
hermesdj committed Jun 24, 2023
1 parent be73c07 commit 4e72baf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 7 additions & 2 deletions es/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,13 @@ function createFileSchema(bucket) {
return done(error);
}
// read file details
// eslint-disable-next-line no-underscore-dangle
return this.constructor.findById(created._id, done);
return (
this.constructor
// eslint-disable-next-line no-underscore-dangle
.findById(created._id)
.then((res) => done(null, res))
.catch((err) => done(err))
);
}.bind(this)
);
};
Expand Down
9 changes: 7 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,13 @@ function createFileSchema(bucket) {
return done(error);
}
// read file details
// eslint-disable-next-line no-underscore-dangle
return this.constructor.findById(created._id, done);
return (
this.constructor
// eslint-disable-next-line no-underscore-dangle
.findById(created._id)
.then((res) => done(null, res))
.catch((err) => done(err))
);
}.bind(this)
);
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hermesdj/mongoose-gridfs",
"version": "1.4.0",
"version": "1.4.1",
"main": "lib/index.js",
"module": "es/index.js",
"scripts": {
Expand Down

0 comments on commit 4e72baf

Please sign in to comment.