From 280045fc4f11adfd9b87f08c6f3a68147372cf8d Mon Sep 17 00:00:00 2001 From: rikaaa0928 <8528731+rikaaa0928@users.noreply.github.com> Date: Thu, 4 Jul 2024 16:57:13 +0800 Subject: [PATCH] [enhancement] JCommon MongoDB MongoService add option for delete (#857) --- .../src/main/java/run/mone/service/MongoService.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jcommon/docean-plugin/docean-plugin-mongodb/src/main/java/run/mone/service/MongoService.java b/jcommon/docean-plugin/docean-plugin-mongodb/src/main/java/run/mone/service/MongoService.java index 8b5726413..315a675ac 100644 --- a/jcommon/docean-plugin/docean-plugin-mongodb/src/main/java/run/mone/service/MongoService.java +++ b/jcommon/docean-plugin/docean-plugin-mongodb/src/main/java/run/mone/service/MongoService.java @@ -2,6 +2,7 @@ import com.xiaomi.youpin.docean.anno.Service; import dev.morphia.Datastore; +import dev.morphia.DeleteOptions; import dev.morphia.UpdateOptions; import dev.morphia.query.FindOptions; import dev.morphia.query.filters.Filter; @@ -101,6 +102,11 @@ public boolean delete(Filter filter) { return true; } + public boolean delete(Filter filter, DeleteOptions options) { + datastore.find(this.clazz).filter(filter).delete(options); + return true; + } + public boolean update(T t) { t.setUtime(System.currentTimeMillis()); datastore.merge(t);