-
- All Implemented Interfaces:
public final class MongoServiceContains all the functions in order to use MongoDB Database.
-
-
Constructor Summary
Constructors Constructor Description MongoService()
-
Method Summary
Modifier and Type Method Description final UnitstartService(String uri)Requires an active instance of MongoDB at the given uri. final UnitconnectToDB(String dbName)Connects to a specific database. final UnitcreateCollection(String collectionName)Creates a collection inside the Mongo database. final UnitpushToDatabase(Document document)Send the created document to the Mongo collection. final UnitstopService()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.
-
-
-
-