Created
April 10, 2018 23:07
-
-
Save siavashalipour/29789b4504d05a73886508927a0cac63 to your computer and use it in GitHub Desktop.
ServerSideSwift - MongoDataBaseService
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MongoDBService.swift | |
// UserAPI | |
// | |
// Created by Siavash on 9/4/18. | |
// | |
import MongoKitten | |
struct MongoDataBaseService { | |
let myDatabase: Database? | |
init() { | |
myDatabase = try? MongoKitten.Database("mongodb://localhost/UserAPI") | |
} | |
func getCollection() -> MongoKitten.Collection? { | |
guard let db = myDatabase else { return nil } | |
return db["Users"] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment