You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -96,26 +96,18 @@ Then run `pod install` to install your project's dependencies.
96
96
97
97
## Example Usage
98
98
99
-
### Initialization
100
-
You *must* call `MongoSwift.initialize()` once at the start of your application to
101
-
initialize `libmongoc`. This initializes global state, such as process counters. Subsequent calls will have no effect.
102
-
103
-
You should call `MongoSwift.cleanup()` exactly once at the end of your application to release all memory and other resources allocated by `libmongoc`. `MongoSwift.initialize()`
104
-
will *not* reinitialize the driver after `MongoSwift.cleanup()`.
99
+
Note: You should call `cleanupMongoSwift()` exactly once at the end of your application to release all memory and other resources allocated by `libmongoc`.
105
100
106
101
### Connect to MongoDB and Create a Collection
107
102
```swift
108
103
importMongoSwift
109
104
110
-
// initialize global state
111
-
MongoSwift.initialize()
112
-
113
105
let client =tryMongoClient("mongodb://localhost:27017")
114
106
let db = client.db("myDB")
115
107
let collection =try db.createCollection("myCollection")
116
108
117
109
// free all resources
118
-
MongoSwift.cleanup()
110
+
cleanupMongoSwift()
119
111
```
120
112
121
113
Note: we have included the client `connectionString` parameter for clarity, but if connecting to the default `"mongodb://localhost:27017"`it may be omitted: `let client = try MongoClient()`.
0 commit comments