A Mac app for working with Mongo databases.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

37 lines
723 B

//
// MongoController.swift
// MongoView
//
// Created by Shadowfacts on 1/8/20.
// Copyright © 2020 Shadowfacts. All rights reserved.
//
import Foundation
import MongoSwift
import NIO
class MongoController {
let connectionString: String
var group: EventLoopGroup!
var client: MongoClient!
init(connectionString: String) {
self.connectionString = connectionString
}
deinit {
try! group.syncShutdownGracefully()
cleanupMongoSwift()
}
func setup() {
print("setting up mongo")
group = MultiThreadedEventLoopGroup(numberOfThreads: 1)
client = try! MongoClient(connectionString, using: group)
}
}