Skip to content

Commit

Permalink
fix: removeMany should not throw an error if deleteCount equal 0 to k…
Browse files Browse the repository at this point in the history
…eep same behavior between mongoose v5 and v6 (#416)
  • Loading branch information
francois-spectre authored Sep 21, 2022
1 parent c1ea275 commit a9f34e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/resolvers/removeMany.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export function removeMany<TSource = any, TContext = any, TDoc extends Document

const res = await beforeQueryHelper(resolveParams);

if (res.deletedCount) {
if (typeof res.deletedCount === 'number') {
// mongoose v6
return {
numAffected: res.deletedCount,
Expand Down

0 comments on commit a9f34e9

Please sign in to comment.