Package dev.morphia

Class Morphia


  • public final class Morphia
    extends Object
    Entry point for working with Morphia
    • Method Detail

      • createDatastore

        public static Datastore createDatastore​(String dbName)
        Creates a Datastore
        Parameters:
        dbName - the name of the database
        Returns:
        a Datastore that you can use to interact with MongoDB
      • createDatastore

        public static Datastore createDatastore​(String dbName,
                                                MapperOptions options)
        Creates a Datastore
        Parameters:
        dbName - the name of the database
        options - the mapping options to use.
        Returns:
        a Datastore that you can use to interact with MongoDB
      • createDatastore

        public static Datastore createDatastore​(com.mongodb.client.MongoClient mongoClient,
                                                String dbName,
                                                MapperOptions options)
        It is best to use a Mongo singleton instance here.
        Parameters:
        mongoClient - the client to use
        dbName - the name of the database
        options - the mapping options to use.
        Returns:
        a Datastore that you can use to interact with MongoDB
      • createDatastore

        public static Datastore createDatastore​(com.mongodb.client.MongoClient mongoClient,
                                                String dbName)
        It is best to use a Mongo singleton instance here.
        Parameters:
        mongoClient - the client to use
        dbName - the name of the database
        Returns:
        a Datastore that you can use to interact with MongoDB