diff --git a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/impl/ReactiveMongoCollectionImpl.java b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/impl/ReactiveMongoCollectionImpl.java index acac2af661e43..73fe055c1bdd9 100644 --- a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/impl/ReactiveMongoCollectionImpl.java +++ b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/impl/ReactiveMongoCollectionImpl.java @@ -667,6 +667,27 @@ public Uni findOneAndUpdate(ClientSession clientSession, Bson filter, Bson up return Wrappers.toUni(collection.findOneAndUpdate(clientSession, filter, update, options)); } + @Override + public Uni findOneAndUpdate(Bson filter, List update) { + return Wrappers.toUni(collection.findOneAndUpdate(filter, update)); + } + + @Override + public Uni findOneAndUpdate(Bson filter, List update, FindOneAndUpdateOptions options) { + return Wrappers.toUni(collection.findOneAndUpdate(filter, update, options)); + } + + @Override + public Uni findOneAndUpdate(ClientSession clientSession, Bson filter, List update) { + return Wrappers.toUni(collection.findOneAndUpdate(clientSession, filter, update)); + } + + @Override + public Uni findOneAndUpdate(ClientSession clientSession, Bson filter, List update, + FindOneAndUpdateOptions options) { + return Wrappers.toUni(collection.findOneAndUpdate(clientSession, filter, update, options)); + } + @Override public Uni drop() { return Wrappers.toUni(collection.drop()); diff --git a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/reactive/ReactiveMongoCollection.java b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/reactive/ReactiveMongoCollection.java index 65ecdb58f72a4..36a32016a25dc 100644 --- a/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/reactive/ReactiveMongoCollection.java +++ b/extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/reactive/ReactiveMongoCollection.java @@ -1217,6 +1217,59 @@ Uni findOneAndReplace(ClientSession clientSession, Bson filter, T replacement Uni findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update, FindOneAndUpdateOptions options); + /** + * Atomically find a document and update it. + * + *

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

+ * @param filter a document describing the query filter, which may not be null. + * @param update a pipeline describing the update, which may not be null. + * @return a publisher with a single element the document that was updated. Depending on the value of the {@code returnOriginal} + * property, this will either be the document as it was before the update or as it is after the update. If no documents matched the + * query filter, then null will be returned + */ + Uni findOneAndUpdate(Bson filter, List update); + + /** + * Atomically find a document and update it. + * + *

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

+ * @param filter a document describing the query filter, which may not be null. + * @param update a pipeline describing the update, which may not be null. + * @param options the options to apply to the operation + * @return a publisher with a single element the document that was updated. Depending on the value of the {@code returnOriginal} + * property, this will either be the document as it was before the update or as it is after the update. If no documents matched the + * query filter, then null will be returned + */ + Uni findOneAndUpdate(Bson filter, List update, FindOneAndUpdateOptions options); + + /** + * Atomically find a document and update it. + * + *

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

+ * @param clientSession the client session with which to associate this operation + * @param filter a document describing the query filter, which may not be null. + * @param update a pipeline describing the update, which may not be null. + * @return a publisher with a single element the document that was updated. Depending on the value of the {@code returnOriginal} + * property, this will either be the document as it was before the update or as it is after the update. If no documents matched the + * query filter, then null will be returned + */ + Uni findOneAndUpdate(ClientSession clientSession, Bson filter, List update); + + /** + * Atomically find a document and update it. + * + *

Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.

+ * @param clientSession the client session with which to associate this operation + * @param filter a document describing the query filter, which may not be null. + * @param update a pipeline describing the update, which may not be null. + * @param options the options to apply to the operation + * @return a publisher with a single element the document that was updated. Depending on the value of the {@code returnOriginal} + * property, this will either be the document as it was before the update or as it is after the update. If no documents matched the + * query filter, then null will be returned + */ + Uni findOneAndUpdate(ClientSession clientSession, Bson filter, List update, + FindOneAndUpdateOptions options); + /** * Drops this collection from the database. *