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)
        Deprecated.
        use createDatastore(MongoClient) and provide a configuration file instead. See the website docs for more detail
        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​(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​(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
      • createDatastore

        public static Datastore createDatastore​(MongoClient mongoClient)
        Creates a Datastore configured via config file. If no config file exists, then defaults will be applied as defined in the MorphiaConfig interface.
        Parameters:
        mongoClient - the client to use
        Returns:
        a Datastore that you can use to interact with MongoDB
        Since:
        2.4.0
      • createDatastore

        public static Datastore createDatastore​(MongoClient mongoClient,
                                                MorphiaConfig config)
        Creates a Datastore configured via config file
        Parameters:
        mongoClient - the client to use
        config - the configuration to use
        Returns:
        a Datastore that you can use to interact with MongoDB
        Since:
        3.0.0