Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions Sources/MongoSwift/ChangeStreamOptions.swift
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
/// Describes the modes for configuring the fullDocument field of a change stream document.
public enum FullDocument: RawRepresentable, Codable {
public struct FullDocument: RawRepresentable, Codable {
/// Specifies that the `fullDocument` field of an update event will contain a copy of the entire document that
/// was changed from some time after the change occurred. If the document was deleted since the updated happened,
/// it will be nil.
case updateLookup
public static let updateLookup = FullDocument("updateLookup")
/// For an unknown value. For forwards compatibility, no error will be thrown when an unknown value is provided.
case other(String)

public var rawValue: String {
switch self {
case .updateLookup:
return "updateLookup"
case let .other(v):
return v
}
public static func other(_ value: String) -> FullDocument {
FullDocument(value)
}

public init?(rawValue: String) {
switch rawValue {
case "updateLookup":
self = .updateLookup
default:
self = .other(rawValue)
}
}
public var rawValue: String

/// Creates a `FullDocument`. Never returns nil.
public init?(rawValue: String) { self.rawValue = rawValue }
internal init(_ value: String) { self.rawValue = value }
}

/// Options to use when creating a `ChangeStream`.
Expand Down
2 changes: 1 addition & 1 deletion Sources/MongoSwiftSync/Exports.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
@_exported import struct MongoSwift.FindOneAndUpdateOptions
@_exported import struct MongoSwift.FindOneOptions
@_exported import struct MongoSwift.FindOptions
@_exported import enum MongoSwift.FullDocument
@_exported import struct MongoSwift.FullDocument
@_exported import enum MongoSwift.IndexHint
@_exported import struct MongoSwift.IndexModel
@_exported import struct MongoSwift.IndexOptions
Expand Down