Class MongoService

  • All Implemented Interfaces:

    
    public final class MongoService
    
                        

    Contains all the functions in order to use MongoDB Database.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      MongoService()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MongoService

        MongoService()
    • Method Detail

      • 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.