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
Do you want to request a feature or report a bug?
Bug What is the current behavior?
When orFail() is chained on a findOneAndRemove() or findByIdAndRemove() query, no error is thrown when no document is found. Instead the query result is null as if orFail() was not used.
If the current behavior is a bug, please provide the steps to reproduce.
Person.findByIdAndRemove(id).orFail().then(deletedPerson=>{if(deletedPerson){console.log("deleted:",deletedPerson);}else{console.log("nothing to delete");// this block should not be reachable if orFail() worked}}).catch(err=>console.log("error:",err));
What is the expected behavior?
See above. What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node: 14.4.0
Mongoose: 5.10.3
MongoDB: 3.6.1
See also #7280 (mentions also this same issue), #8030
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When
orFail()
is chained on afindOneAndRemove()
orfindByIdAndRemove()
query, no error is thrown when no document is found. Instead the query result isnull
as iforFail()
was not used.If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
See above.
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Node: 14.4.0
Mongoose: 5.10.3
MongoDB: 3.6.1
See also #7280 (mentions also this same issue), #8030
The text was updated successfully, but these errors were encountered: