Skip to content

Commit

Permalink
Add missing methods to ReactiveMongoCollection
Browse files Browse the repository at this point in the history
Fixes #38114

(cherry picked from commit 8debb80)
  • Loading branch information
loicmathieu authored and gsmet committed Jan 15, 2024
1 parent f6082fb commit 98ae832
Show file tree
Hide file tree
Showing 2 changed files with 232 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,27 @@ public Uni<UpdateResult> updateOne(ClientSession clientSession, Bson filter, Bso
return Wrappers.toUni(collection.updateOne(clientSession, filter, update, options));
}

@Override
public Uni<UpdateResult> updateOne(Bson filter, List<? extends Bson> update) {
return Wrappers.toUni(collection.updateOne(filter, update));
}

@Override
public Uni<UpdateResult> updateOne(Bson filter, List<? extends Bson> update, UpdateOptions options) {
return Wrappers.toUni(collection.updateOne(filter, update, options));
}

@Override
public Uni<UpdateResult> updateOne(ClientSession clientSession, Bson filter, List<? extends Bson> update) {
return Wrappers.toUni(collection.updateOne(clientSession, filter, update));
}

@Override
public Uni<UpdateResult> updateOne(ClientSession clientSession, Bson filter, List<? extends Bson> update,
UpdateOptions options) {
return Wrappers.toUni(collection.updateOne(clientSession, filter, update, options));
}

@Override
public Uni<UpdateResult> updateMany(Bson filter, Bson update) {
return Wrappers.toUni(collection.updateMany(filter, update));
Expand All @@ -605,6 +626,27 @@ public Uni<UpdateResult> updateMany(ClientSession clientSession, Bson filter, Bs
return Wrappers.toUni(collection.updateMany(clientSession, filter, update, options));
}

@Override
public Uni<UpdateResult> updateMany(Bson filter, List<? extends Bson> update) {
return Wrappers.toUni(collection.updateMany(filter, update));
}

@Override
public Uni<UpdateResult> updateMany(Bson filter, List<? extends Bson> update, UpdateOptions options) {
return Wrappers.toUni(collection.updateMany(filter, update, options));
}

@Override
public Uni<UpdateResult> updateMany(ClientSession clientSession, Bson filter, List<? extends Bson> update) {
return Wrappers.toUni(collection.updateMany(clientSession, filter, update));
}

@Override
public Uni<UpdateResult> updateMany(ClientSession clientSession, Bson filter, List<? extends Bson> update,
UpdateOptions options) {
return Wrappers.toUni(collection.updateMany(clientSession, filter, update, options));
}

@Override
public Uni<T> findOneAndDelete(Bson filter) {
return Wrappers.toUni(collection.findOneAndDelete(filter));
Expand Down Expand Up @@ -667,6 +709,27 @@ public Uni<T> findOneAndUpdate(ClientSession clientSession, Bson filter, Bson up
return Wrappers.toUni(collection.findOneAndUpdate(clientSession, filter, update, options));
}

@Override
public Uni<T> findOneAndUpdate(Bson filter, List<? extends Bson> update) {
return Wrappers.toUni(collection.findOneAndUpdate(filter, update));
}

@Override
public Uni<T> findOneAndUpdate(Bson filter, List<? extends Bson> update, FindOneAndUpdateOptions options) {
return Wrappers.toUni(collection.findOneAndUpdate(filter, update, options));
}

@Override
public Uni<T> findOneAndUpdate(ClientSession clientSession, Bson filter, List<? extends Bson> update) {
return Wrappers.toUni(collection.findOneAndUpdate(clientSession, filter, update));
}

@Override
public Uni<T> findOneAndUpdate(ClientSession clientSession, Bson filter, List<? extends Bson> update,
FindOneAndUpdateOptions options) {
return Wrappers.toUni(collection.findOneAndUpdate(clientSession, filter, update, options));
}

@Override
public Uni<Void> drop() {
return Wrappers.toUni(collection.drop());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,62 @@ Uni<UpdateResult> replaceOne(ClientSession clientSession, Bson filter, T replace
Uni<UpdateResult> updateOne(ClientSession clientSession, Bson filter, Bson update,
UpdateOptions options);

/**
* Update a single document in the collection according to the specified arguments.
*
* <p>
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* </p>
*
* @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 UpdateResult
*/
Uni<UpdateResult> updateOne(Bson filter, List<? extends Bson> update);

/**
* Update a single document in the collection according to the specified arguments.
*
* <p>
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* </p>
*
* @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 update operation
* @return a publisher with a single element the UpdateResult
*/
Uni<UpdateResult> updateOne(Bson filter, List<? extends Bson> update, UpdateOptions options);

/**
* Update a single document in the collection according to the specified arguments.
*
* <p>
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* </p>
*
* @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 UpdateResult
*/
Uni<UpdateResult> updateOne(ClientSession clientSession, Bson filter, List<? extends Bson> update);

/**
* Update a single document in the collection according to the specified arguments.
*
* <p>
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* </p>
*
* @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 update operation
* @return a publisher with a single element the UpdateResult
*/
Uni<UpdateResult> updateOne(ClientSession clientSession, Bson filter, List<? extends Bson> update, UpdateOptions options);

/**
* Update all documents in the collection according to the specified arguments.
*
Expand Down Expand Up @@ -1059,6 +1115,46 @@ Uni<UpdateResult> updateOne(ClientSession clientSession, Bson filter, Bson updat
Uni<UpdateResult> updateMany(ClientSession clientSession, Bson filter, Bson update,
UpdateOptions options);

/**
* Update all documents in the collection according to the specified arguments.
*
* @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 UpdateResult
*/
Uni<UpdateResult> updateMany(Bson filter, List<? extends Bson> update);

/**
* Update all documents in the collection according to the specified arguments.
*
* @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 update operation
* @return a publisher with a single element the UpdateResult
*/
Uni<UpdateResult> updateMany(Bson filter, List<? extends Bson> update, UpdateOptions options);

/**
* Update all documents in the collection according to the specified arguments.
*
* @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 UpdateResult
*/
Uni<UpdateResult> updateMany(ClientSession clientSession, Bson filter, List<? extends Bson> update);

/**
* Update all documents in the collection according to the specified arguments.
*
* @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 update operation
* @return a publisher with a single element the UpdateResult
*/
Uni<UpdateResult> updateMany(ClientSession clientSession, Bson filter, List<? extends Bson> update, UpdateOptions options);

/**
* Atomically find a document and remove it.
*
Expand Down Expand Up @@ -1217,6 +1313,79 @@ Uni<T> findOneAndReplace(ClientSession clientSession, Bson filter, T replacement
Uni<T> findOneAndUpdate(ClientSession clientSession, Bson filter, Bson update,
FindOneAndUpdateOptions options);

/**
* Atomically find a document and update it.
*
* <p>
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* </p>
*
* @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<T> findOneAndUpdate(Bson filter, List<? extends Bson> update);

/**
* Atomically find a document and update it.
*
* <p>
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* </p>
*
* @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<T> findOneAndUpdate(Bson filter, List<? extends Bson> update, FindOneAndUpdateOptions options);

/**
* Atomically find a document and update it.
*
* <p>
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* </p>
*
* @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<T> findOneAndUpdate(ClientSession clientSession, Bson filter, List<? extends Bson> update);

/**
* Atomically find a document and update it.
*
* <p>
* Note: Supports retryable writes on MongoDB server versions 3.6 or higher when the retryWrites setting is enabled.
* </p>
*
* @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<T> findOneAndUpdate(ClientSession clientSession, Bson filter, List<? extends Bson> update,
FindOneAndUpdateOptions options);

/**
* Drops this collection from the database.
*
Expand Down

0 comments on commit 98ae832

Please sign in to comment.