Class MongoDatabase

    • Method Detail

      • getName

        public String getName()
        Gets the name of the database.
        Returns:
        the database name
      • getCollection

        public MongoCollection<Document> getCollection​(String collectionName)
        Gets a collection.
        Parameters:
        collectionName - the name of the collection to return
        Returns:
        the collection
      • getCollection

        public <DocumentT> MongoCollection<DocumentT> getCollection​(String collectionName,
                                                                    Class<DocumentT> documentClass)
        Gets a collection, with a specific default document class.
        Type Parameters:
        DocumentT - the type of the class to use instead of Document.
        Parameters:
        collectionName - the name of the collection to return
        documentClass - the default class to cast any documents returned from the database into.
        Returns:
        the collection