MongoService

class MongoService

Contains all the functions in order to use MongoDB Database.

Constructors

Link copied to clipboard
fun MongoService()

Functions

Link copied to clipboard
fun connectToDB(dbName: String)

Connects to a specific database. If there is no database with the input name in the mongo instance, an empty one will be created.

Link copied to clipboard
fun createCollection(collectionName: String)

Creates a collection inside the Mongo database. If there is already a collection with the parameter name,

Link copied to clipboard
fun pushToDatabase(document: Document)

Send the created document to the Mongo collection.

Link copied to clipboard
fun startService(uri: String)

Requires an active instance of MongoDB at the given uri.

Link copied to clipboard
fun stopService()

Close the connection with the Mongo instance.