From db43876b198213076f75a2440507b92003c6f723 Mon Sep 17 00:00:00 2001 From: rikaaa0928 Date: Thu, 4 Jul 2024 16:42:05 +0800 Subject: [PATCH] [enhancement] JCommon MongoDB MongoService add option for delete --- .../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);