Skip to content

Commit

Permalink
Delete backups from MongoDB when deleting a world (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
cijaaimee authored Dec 13, 2019
1 parent 66d29da commit 240a717
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ public void deleteWorld(String worldName) throws IOException, UnknownWorldExcept

bucket.delete(file.getObjectId());

// Delete backup file
file = bucket.find(Filters.eq("filename", worldName + "_backup")).first();

if (file != null) {
bucket.delete(file.getObjectId());
}

MongoCollection<Document> mongoCollection = mongoDatabase.getCollection(collection);
mongoCollection.deleteOne(Filters.eq("name", worldName));
} catch (MongoException ex) {
Expand Down

0 comments on commit 240a717

Please sign in to comment.