@@ -11,15 +11,17 @@ extension MongoCollection {
1111 * - options: Optional `FindOneAndDeleteOptions` to use when executing the command
1212 * - session: Optional `ClientSession` to use when executing this command
1313 *
14- * - Returns: An `EventLoopFuture` containing the deleted document, represented as a `CollectionType`, or
15- * containing `nil` if no document was deleted.
14+ * - Returns:
15+ * An `EventLoopFuture<CollectionType?>`. On success, contains either the deleted document, represented as a
16+ * `CollectionType`, or contains `nil` if no document was deleted.
1617 *
17- * - Throws:
18- * - `InvalidArgumentError` if any of the provided options are invalid.
19- * - `LogicError` if the provided session is inactive.
20- * - `CommandError` if an error occurs that prevents the command from executing.
21- * - `WriteError` if an error occurs while executing the command.
22- * - `DecodingError` if the deleted document cannot be decoded to a `CollectionType` value.
18+ * If the future fails, the error is likely one of the following:
19+ * - `InvalidArgumentError` if any of the provided options are invalid.
20+ * - `LogicError` if the provided session is inactive.
21+ * - `LogicError` if this collection's parent client has already been closed.
22+ * - `CommandError` if an error occurs that prevents the command from executing.
23+ * - `WriteError` if an error occurs while executing the command.
24+ * - `DecodingError` if the deleted document cannot be decoded to a `CollectionType` value.
2325 */
2426 public func findOneAndDelete(
2527 _ filter: Document ,
@@ -40,16 +42,19 @@ extension MongoCollection {
4042 * - options: Optional `FindOneAndReplaceOptions` to use when executing the command
4143 * - session: Optional `ClientSession` to use when executing this command
4244 *
43- * - Returns: An `EventLoopFuture` containing a `CollectionType`, representing either the original document or its
44- * replacement, depending on selected options, or containing `nil` if there was no match.
45+ * - Returns:
46+ * An `EventLoopFuture<CollectionType?>`. On success, contains a `CollectionType`, representing either the
47+ * original document or its replacement, depending on selected options; or containing `nil` if there was no
48+ * matching document.
4549 *
46- * - Throws:
47- * - `InvalidArgumentError` if any of the provided options are invalid.
48- * - `LogicError` if the provided session is inactive.
49- * - `CommandError` if an error occurs that prevents the command from executing.
50- * - `WriteError` if an error occurs while executing the command.
51- * - `DecodingError` if the replaced document cannot be decoded to a `CollectionType` value.
52- * - `EncodingError` if `replacement` cannot be encoded to a `Document`.
50+ * If the future fails, the error is likely one of the following:
51+ * - `InvalidArgumentError` if any of the provided options are invalid.
52+ * - `LogicError` if the provided session is inactive.
53+ * - `LogicError` if this collection's parent client has already been closed.
54+ * - `CommandError` if an error occurs that prevents the command from executing.
55+ * - `WriteError` if an error occurs while executing the command.
56+ * - `DecodingError` if the replaced document cannot be decoded to a `CollectionType` value.
57+ * - `EncodingError` if `replacement` cannot be encoded to a `Document`.
5358 */
5459 public func findOneAndReplace(
5560 filter: Document ,
@@ -74,15 +79,17 @@ extension MongoCollection {
7479 * - options: Optional `FindOneAndUpdateOptions` to use when executing the command
7580 * - session: Optional `ClientSession` to use when executing this command
7681 *
77- * - Returns: An `EventLoopFuture` containing a `CollectionType` representing either the original or updated
78- * document, depending on selected options, or containing `nil` if there was no match.
82+ * - Returns:
83+ * An `EventLoopFuture<CollectionType>`. On success, contains either the original or updated document, depending
84+ * on selected options, or contains `nil` if there was no match.
7985 *
80- * - Throws:
81- * - `InvalidArgumentError` if any of the provided options are invalid.
82- * - `LogicError` if the provided session is inactive.
83- * - `CommandError` if an error occurs that prevents the command from executing.
84- * - `WriteError` if an error occurs while executing the command.
85- * - `DecodingError` if the updated document cannot be decoded to a `CollectionType` value.
86+ * If the future fails, the error is likely one of the following:
87+ * - `InvalidArgumentError` if any of the provided options are invalid.
88+ * - `LogicError` if the provided session is inactive.
89+ * - `LogicError` if this collection's parent client has already been closed.
90+ * - `CommandError` if an error occurs that prevents the command from executing.
91+ * - `WriteError` if an error occurs while executing the command.
92+ * - `DecodingError` if the updated document cannot be decoded to a `CollectionType` value.
8693 */
8794 public func findOneAndUpdate(
8895 filter: Document ,
@@ -96,12 +103,16 @@ extension MongoCollection {
96103 /**
97104 * A private helper method for findAndModify operations to use.
98105 *
99- * - Throws:
100- * - `InvalidArgumentError` if any of the provided options are invalid.
101- * - `LogicError` if the provided session is inactive.
102- * - `CommandError` if an error occurs that prevents the command from executing.
103- * - `WriteError` if an error occurs while executing the command.
104- * - `DecodingError` if the updated document cannot be decoded to a `CollectionType` value.
106+ * - Returns:
107+ * An `EventLoopFuture<CollectionType?>. On success, contains the document returned by the server, if one exists.
108+ *
109+ * If the future fails, the error is likely one of the following:
110+ * - `InvalidArgumentError` if any of the provided options are invalid.
111+ * - `LogicError` if the provided session is inactive.
112+ * - `LogicError` if this collection's parent client has already been closed.
113+ * - `CommandError` if an error occurs that prevents the command from executing.
114+ * - `WriteError` if an error occurs while executing the command.
115+ * - `DecodingError` if the updated document cannot be decoded to a `CollectionType` value.
105116 */
106117 private func findAndModify(
107118 filter: Document ,
0 commit comments