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
9 changes: 0 additions & 9 deletions Sources/MongoSwift/ReadConcern.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ public struct ReadConcern: Codable {
self.level = nil
}

/// Initializes a new `ReadConcern` from a `Document`.
public init(_ doc: Document) {
if let level = doc["level"]?.stringValue {
self.init(level)
} else {
self.init()
}
}

/**
* Creates a new `mongoc_read_concern_t` based on this `ReadConcern` and passes it to the provided closure.
* The pointer is only valid within the body of the closure and will be freed after the body completes.
Expand Down
6 changes: 3 additions & 3 deletions Tests/MongoSwiftTests/ReadWriteConcernTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ final class ReadWriteConcernTests: MongoSwiftTestCase {
expect(rc2.isDefault).to(beTrue())

// test init from doc
let rc3 = ReadConcern(["level": "majority"])
let rc3 = try BSONDecoder().decode(ReadConcern.self, from: ["level": "majority"])
expect(rc3.level).to(equal(.majority))

// test string init
Expand Down Expand Up @@ -586,7 +586,7 @@ final class ReadWriteConcernTests: MongoSwiftTestCase {
if valid {
let client = try MongoClient(uri)
if let readConcern = test["readConcern"]?.documentValue {
let rc = ReadConcern(readConcern)
let rc = try BSONDecoder().decode(ReadConcern.self, from: readConcern)
if rc.isDefault {
expect(client.readConcern).to(beNil())
} else {
Expand Down Expand Up @@ -620,7 +620,7 @@ final class ReadWriteConcernTests: MongoSwiftTestCase {
for test in tests {
let valid: Bool = try test.get("valid")
if let rcToUse = test["readConcern"]?.documentValue {
let rc = ReadConcern(rcToUse)
let rc = try BSONDecoder().decode(ReadConcern.self, from: rcToUse)

let isDefault: Bool = try test.get("isServerDefault")
expect(rc.isDefault).to(equal(isDefault))
Expand Down