You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bucket(client.db(), options.bucketOptions).delete(fd, (err) => errorHandler(err, client));
if (cb) cb();
The second line is always executed if cb exists.
The first line performs the deletion, but if no file is found with the given fd, errorHandler is called, this function in turn calls cb passing an err, if cb exists.
The problem encountered is that cb is called twice, if cb exists and no file is found with fd passed to the function, thus meeting the two rules mentioned above. So for a cb like this:
In fact, call back function in bucket.delete() is always called, even if fd matches to a file in GridFS. If you debug you will see it being called with err = null (because there is no error).
Hi everyone, I have encountered a small problem in your code, take a look at this excerpt from the rm function:
I need a little attention on these two lines:
The problem encountered is that cb is called twice, if cb exists and no file is found with fd passed to the function, thus meeting the two rules mentioned above. So for a cb like this:
res.send is called twice, one containing the err and again without err generating the following error:
Forgiveness for English, text translated by Google Translate.
The text was updated successfully, but these errors were encountered: