File tree Expand file tree Collapse file tree 2 files changed +3
-12
lines changed Expand file tree Collapse file tree 2 files changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -83,15 +83,6 @@ public struct ReadConcern: Codable {
8383 self . level = nil
8484 }
8585
86- /// Initializes a new `ReadConcern` from a `Document`.
87- public init ( _ doc: Document ) {
88- if let level = doc [ " level " ] ? . stringValue {
89- self . init ( level)
90- } else {
91- self . init ( )
92- }
93- }
94-
9586 /**
9687 * Creates a new `mongoc_read_concern_t` based on this `ReadConcern` and passes it to the provided closure.
9788 * The pointer is only valid within the body of the closure and will be freed after the body completes.
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ final class ReadWriteConcernTests: MongoSwiftTestCase {
103103 expect ( rc2. isDefault) . to ( beTrue ( ) )
104104
105105 // test init from doc
106- let rc3 = ReadConcern ( [ " level " : " majority " ] )
106+ let rc3 = try BSONDecoder ( ) . decode ( ReadConcern . self , from : [ " level " : " majority " ] )
107107 expect ( rc3. level) . to ( equal ( . majority) )
108108
109109 // test string init
@@ -586,7 +586,7 @@ final class ReadWriteConcernTests: MongoSwiftTestCase {
586586 if valid {
587587 let client = try MongoClient ( uri)
588588 if let readConcern = test [ " readConcern " ] ? . documentValue {
589- let rc = ReadConcern ( readConcern)
589+ let rc = try BSONDecoder ( ) . decode ( ReadConcern . self , from : readConcern)
590590 if rc. isDefault {
591591 expect ( client. readConcern) . to ( beNil ( ) )
592592 } else {
@@ -620,7 +620,7 @@ final class ReadWriteConcernTests: MongoSwiftTestCase {
620620 for test in tests {
621621 let valid : Bool = try test. get ( " valid " )
622622 if let rcToUse = test [ " readConcern " ] ? . documentValue {
623- let rc = ReadConcern ( rcToUse)
623+ let rc = try BSONDecoder ( ) . decode ( ReadConcern . self , from : rcToUse)
624624
625625 let isDefault : Bool = try test. get ( " isServerDefault " )
626626 expect ( rc. isDefault) . to ( equal ( isDefault) )
You can’t perform that action at this time.
0 commit comments