Skip to content

Commit aa78672

Browse files
committed
Update change stream docstrings, remove leftover throws
1 parent 478df3f commit aa78672

File tree

5 files changed

+71
-65
lines changed

5 files changed

+71
-65
lines changed

Sources/MongoSwift/MongoClient.swift

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,14 @@ public class MongoClient {
457457
* - options: An optional `ChangeStreamOptions` to use when constructing the change stream.
458458
* - session: An optional `ClientSession` to use with this change stream.
459459
*
460-
* - Returns: An `EventLoopFuture<ChangeStream>` containing a `ChangeStream` watching all collections in this
461-
* deployment.
460+
* - Returns:
461+
* An `EventLoopFuture<ChangeStream>`. On success, contains a `ChangeStream` watching all collections in this
462+
* deployment.
462463
*
463-
* - Throws:
464-
* - `CommandError` if an error occurs on the server while creating the change stream.
465-
* - `InvalidArgumentError` if the options passed formed an invalid combination.
466-
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
467-
* pipeline.
464+
* If the future fails, the error is likely one of the following:
465+
* - `CommandError` if an error occurs on the server while creating the change stream.
466+
* - `InvalidArgumentError` if the options passed formed an invalid combination.
467+
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the pipeline.
468468
*
469469
* - SeeAlso:
470470
* - https://docs.mongodb.com/manual/changeStreams/
@@ -477,7 +477,7 @@ public class MongoClient {
477477
_ pipeline: [Document] = [],
478478
options: ChangeStreamOptions? = nil,
479479
session: ClientSession? = nil
480-
) throws -> EventLoopFuture<ChangeStream<ChangeStreamEvent<Document>>> {
480+
) -> EventLoopFuture<ChangeStream<ChangeStreamEvent<Document>>> {
481481
return self.watch(pipeline, options: options, session: session, withFullDocumentType: Document.self)
482482
}
483483

@@ -494,14 +494,14 @@ public class MongoClient {
494494
* - withFullDocumentType: The type that the `fullDocument` field of the emitted `ChangeStreamEvent`s will be
495495
* decoded to.
496496
*
497-
* - Returns: An `EventLoopFuture<ChangeStream>` containing a `ChangeStream` watching all collections in this
498-
* deployment.
497+
* - Returns:
498+
* An `EventLoopFuture<ChangeStream>`. On success, contains a `ChangeStream` watching all collections in this
499+
* deployment.
499500
*
500-
* - Throws:
501-
* - `CommandError` if an error occurs on the server while creating the change stream.
502-
* - `InvalidArgumentError` if the options passed formed an invalid combination.
503-
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
504-
* pipeline.
501+
* If the future fails, the error is likely one of the following:
502+
* - `CommandError` if an error occurs on the server while creating the change stream.
503+
* - `InvalidArgumentError` if the options passed formed an invalid combination.
504+
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the pipeline.
505505
*
506506
* - SeeAlso:
507507
* - https://docs.mongodb.com/manual/changeStreams/
@@ -536,14 +536,14 @@ public class MongoClient {
536536
* - withEventType: The type that the entire change stream response will be decoded to and that will be returned
537537
* when iterating through the change stream.
538538
*
539-
* - Returns: An `EventLoopFuture<ChangeStream>` containing a `ChangeStream` watching all collections in this
540-
* deployment.
539+
* - Returns:
540+
* An `EventLoopFuture<ChangeStream>`. On success, contains a `ChangeStream` watching all collections in this
541+
* deployment.
541542
*
542-
* - Throws:
543-
* - `CommandError` if an error occurs on the server while creating the change stream.
544-
* - `InvalidArgumentError` if the options passed formed an invalid combination.
545-
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
546-
* pipeline.
543+
* If the future fails, the error is likely one of the following:
544+
* - `CommandError` if an error occurs on the server while creating the change stream.
545+
* - `InvalidArgumentError` if the options passed formed an invalid combination.
546+
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the pipeline.
547547
*
548548
* - SeeAlso:
549549
* - https://docs.mongodb.com/manual/changeStreams/

Sources/MongoSwift/MongoCollection+ChangeStreams.swift

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@ extension MongoCollection {
1212
* - options: An optional `ChangeStreamOptions` to use when constructing the change stream.
1313
* - session: An optional `ClientSession` to use with this change stream.
1414
*
15-
* - Returns: An `EventLoopFuture<ChangeStream>` containing a `ChangeStream` watching this collection.
15+
* - Returns:
16+
* An `EventLoopFuture<ChangeStream>`. On success, contains a `ChangeStream` watching this collection.
1617
*
17-
* - Throws:
18-
* - `CommandError` if an error occurs on the server while creating the change stream.
19-
* - `InvalidArgumentError` if the options passed formed an invalid combination.
20-
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
21-
* pipeline.
18+
* If the future fails, the error is likely one of the following:
19+
* - `CommandError` if an error occurs on the server while creating the change stream.
20+
* - `InvalidArgumentError` if the options passed formed an invalid combination.
21+
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
22+
* pipeline.
2223
*
2324
* - SeeAlso:
2425
* - https://docs.mongodb.com/manual/changeStreams/
@@ -45,13 +46,14 @@ extension MongoCollection {
4546
* - withFullDocumentType: The type that the `fullDocument` field of the emitted `ChangeStreamEvent`s will be
4647
* decoded to.
4748
*
48-
* - Returns: An `EventLoopFuture<ChangeStream>` containing a `ChangeStream` watching this collection.
49+
* - Returns:
50+
* An `EventLoopFuture<ChangeStream>`. On success, contains a `ChangeStream` watching this collection.
4951
*
50-
* - Throws:
51-
* - `CommandError` if an error occurs on the server while creating the change stream.
52-
* - `InvalidArgumentError` if the options passed formed an invalid combination.
53-
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
54-
* pipeline.
52+
* If the future fails, the error is likely one of the following:
53+
* - `CommandError` if an error occurs on the server while creating the change stream.
54+
* - `InvalidArgumentError` if the options passed formed an invalid combination.
55+
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
56+
* pipeline.
5557
*
5658
* - SeeAlso:
5759
* - https://docs.mongodb.com/manual/changeStreams/
@@ -83,13 +85,14 @@ extension MongoCollection {
8385
* - withEventType: The type that the entire change stream response will be decoded to and that will be returned
8486
* when iterating through the change stream.
8587
*
86-
* - Returns: An `EventLoopFuture<ChangeStream>` containing a `ChangeStream` watching this collection.
88+
* - Returns:
89+
* An `EventLoopFuture<ChangeStream>`. On success, contains a `ChangeStream` watching this collection.
8790
*
88-
* - Throws:
89-
* - `CommandError` if an error occurs on the server while creating the change stream.
90-
* - `InvalidArgumentError` if the options passed formed an invalid combination.
91-
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
92-
* pipeline.
91+
* If the future fails, the error is likely one of the following:
92+
* - `CommandError` if an error occurs on the server while creating the change stream.
93+
* - `InvalidArgumentError` if the options passed formed an invalid combination.
94+
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
95+
* pipeline.
9396
*
9497
* - SeeAlso:
9598
* - https://docs.mongodb.com/manual/changeStreams/

Sources/MongoSwift/MongoCollection+Indexes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ extension MongoCollection {
406406
* - `LogicError` if the provided session is inactive.
407407
* - `LogicError` if this collection's parent client has already been closed.
408408
*/
409-
public func listIndexNames(session _: ClientSession? = nil) throws -> EventLoopFuture<[String]> {
409+
public func listIndexNames(session _: ClientSession? = nil) -> EventLoopFuture<[String]> {
410410
return self.listIndexes().flatMap { cursor in
411411
cursor.all()
412412
}.flatMapThrowing { models in

Sources/MongoSwift/MongoCollection+Read.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ extension MongoCollection {
5151
_ filter: Document = [:],
5252
options: FindOneOptions? = nil,
5353
session: ClientSession? = nil
54-
) throws -> EventLoopFuture<T?> {
54+
) -> EventLoopFuture<T?> {
5555
let options = options.map { FindOptions(from: $0) }
5656
return self.find(filter, options: options, session: session).flatMap { cursor in
5757
cursor.next().afterSuccess { _ in cursor.kill() }

Sources/MongoSwift/MongoDatabase.swift

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public struct MongoDatabase {
246246
_ filter: Document? = nil,
247247
options: ListCollectionsOptions? = nil,
248248
session: ClientSession? = nil
249-
) throws -> EventLoopFuture<MongoCursor<CollectionSpecification>> {
249+
) -> EventLoopFuture<MongoCursor<CollectionSpecification>> {
250250
let operation = ListCollectionsOperation(database: self, nameOnly: false, filter: filter, options: options)
251251
return self._client.operationExecutor.execute(
252252
operation, client: self._client, session: session
@@ -279,7 +279,7 @@ public struct MongoDatabase {
279279
_ filter: Document? = nil,
280280
options: ListCollectionsOptions? = nil,
281281
session: ClientSession? = nil
282-
) throws -> EventLoopFuture<[MongoCollection<Document>]> {
282+
) -> EventLoopFuture<[MongoCollection<Document>]> {
283283
return self.listCollectionNames(filter, options: options, session: session).map { collNames in
284284
collNames.map { self.collection($0) }
285285
}
@@ -352,14 +352,15 @@ public struct MongoDatabase {
352352
* - options: An optional `ChangeStreamOptions` to use when constructing the change stream.
353353
* - session: An optional `ClientSession` to use with this change stream.
354354
*
355-
* - Returns: An `EventLoopFuture<ChangeStream>` containing a `ChangeStream` watching all collections in this
356-
* database.
355+
* - Returns:
356+
* An `EventLoopFuture<ChangeStream>`. On success, contains a `ChangeStream` watching all collections in this
357+
* database.
357358
*
358-
* - Throws:
359-
* - `CommandError` if an error occurs on the server while creating the change stream.
360-
* - `InvalidArgumentError` if the options passed formed an invalid combination.
361-
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
362-
* pipeline.
359+
* If the future fails, the error is likely one of the following:
360+
* - `CommandError` if an error occurs on the server while creating the change stream.
361+
* - `InvalidArgumentError` if the options passed formed an invalid combination.
362+
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
363+
* pipeline.
363364
*
364365
* - SeeAlso:
365366
* - https://docs.mongodb.com/manual/changeStreams/
@@ -388,14 +389,15 @@ public struct MongoDatabase {
388389
* - withFullDocumentType: The type that the `fullDocument` field of the emitted `ChangeStreamEvent`s will be
389390
* decoded to.
390391
*
391-
* - Returns: An `EventLoopFuture<ChangeStream>` containing a `ChangeStream` watching all collections in this
392-
* database.
392+
* - Returns:
393+
* An `EventLoopFuture<ChangeStream>`. On success, contains a `ChangeStream` watching all collections in this
394+
* database.
393395
*
394-
* - Throws:
395-
* - `CommandError` if an error occurs on the server while creating the change stream.
396-
* - `InvalidArgumentError` if the options passed formed an invalid combination.
397-
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
398-
* pipeline.
396+
* If the future fails, the error is likely one of the following:
397+
* - `CommandError` if an error occurs on the server while creating the change stream.
398+
* - `InvalidArgumentError` if the options passed formed an invalid combination.
399+
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
400+
* pipeline.
399401
*
400402
* - SeeAlso:
401403
* - https://docs.mongodb.com/manual/changeStreams/
@@ -429,14 +431,15 @@ public struct MongoDatabase {
429431
* - withEventType: The type that the entire change stream response will be decoded to and that will be returned
430432
* when iterating through the change stream.
431433
*
432-
* - Returns: An `EventLoopFuture<ChangeStream>` containing a `ChangeStream` watching all collections in this
433-
* database.
434+
* - Returns:
435+
* An `EventLoopFuture<ChangeStream>`. On success, contains a `ChangeStream` watching all collections in this
436+
* database.
434437
*
435-
* - Throws:
436-
* - `CommandError` if an error occurs on the server while creating the change stream.
437-
* - `InvalidArgumentError` if the options passed formed an invalid combination.
438-
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
439-
* pipeline.
438+
* If the future fails, the error is likely one of the following:
439+
* - `CommandError` if an error occurs on the server while creating the change stream.
440+
* - `InvalidArgumentError` if the options passed formed an invalid combination.
441+
* - `InvalidArgumentError` if the `_id` field is projected out of the change stream documents by the
442+
* pipeline.
440443
*
441444
* - SeeAlso:
442445
* - https://docs.mongodb.com/manual/changeStreams/

0 commit comments

Comments
 (0)