Skip to content

Commit

Permalink
Get the info about inserted file from uploadStream.gridFSFile in cases
Browse files Browse the repository at this point in the history
when `file` is undefined.
  • Loading branch information
JSAssassin committed Apr 11, 2024
1 parent 45d4701 commit 749f353
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gridFile.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ schema.method('upload', function (stream, callback) {
})

uploadStream.on('finish', (file) => {
if(!file) {
file = uploadStream.gridFSFile
}
const document = this.model.hydrate(file)

resolve(document)
Expand Down

0 comments on commit 749f353

Please sign in to comment.