Skip to content

Commit

Permalink
Fixed deleteKeyInAll logic
Browse files Browse the repository at this point in the history
Signed-off-by: DevDrizzy <[email protected]>
  • Loading branch information
DevDrizzy committed Mar 17, 2024
1 parent 28754fb commit df4f1c5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/xyz/refinedev/api/storage/MongoStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,11 @@ public CompletableFuture<Integer> deleteKeyInAll(String key) {
for ( Document document : collection.find() ) {
if (document == null) continue;

document.remove(key);
deleteCount++;
if (document.get(key) != null) {
document.remove(key);
deleteCount++;
}
collection.replaceOne(Filters.eq("_id", document.get("_id")), document);
}
return deleteCount;
});
Expand Down

0 comments on commit df4f1c5

Please sign in to comment.