Class MongoService
-
- All Implemented Interfaces:
public final class MongoService
Contains all the functions in order to use MongoDB Database.
-
-
Constructor Summary
Constructors Constructor Description MongoService()
-
Method Summary
Modifier and Type Method Description final Unit
startService(String uri)
Requires an active instance of MongoDB at the given uri. final Unit
connectToDB(String dbName)
Connects to a specific database. final Unit
createCollection(String collectionName)
Creates a collection inside the Mongo database. final Unit
pushToDatabase(Document document)
Send the created document to the Mongo collection. final Unit
stopService()
Close the connection with the Mongo instance. -
-
Method Detail
-
startService
final Unit startService(String uri)
Requires an active instance of MongoDB at the given uri.
-
connectToDB
final Unit connectToDB(String dbName)
Connects to a specific database. If there is no database with the input name in the mongo instance, an empty one will be created.
-
createCollection
final Unit createCollection(String collectionName)
Creates a collection inside the Mongo database. If there is already a collection with the parameter name,
-
pushToDatabase
final Unit pushToDatabase(Document document)
Send the created document to the Mongo collection.
-
stopService
final Unit stopService()
Close the connection with the Mongo instance.
-
-
-
-