Package dev.morphia
Class Morphia
- java.lang.Object
-
- dev.morphia.Morphia
-
public final class Morphia extends Object
Entry point for working with Morphia
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static DatastorecreateDatastore(MongoClient mongoClient)Creates a Datastore configured via config file.static DatastorecreateDatastore(MongoClient mongoClient, MorphiaConfig config)Creates a Datastore configured via config filestatic DatastorecreateDatastore(MongoClient mongoClient, String dbName)It is best to use a Mongo singleton instance here.static DatastorecreateDatastore(MongoClient mongoClient, String dbName, MapperOptions options)It is best to use a Mongo singleton instance here.static DatastorecreateDatastore(String dbName)Deprecated.usecreateDatastore(MongoClient)and provide a configuration file instead.static DatastorecreateDatastore(String dbName, MapperOptions options)Creates a Datastore
-
-
-
Method Detail
-
createDatastore
public static Datastore createDatastore(String dbName)
Deprecated.usecreateDatastore(MongoClient)and provide a configuration file instead. See the website docs for more detailCreates 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 databaseoptions- 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 usedbName- the name of the databaseoptions- 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 usedbName- 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 theMorphiaConfiginterface.- 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 useconfig- the configuration to use- Returns:
- a Datastore that you can use to interact with MongoDB
- Since:
- 3.0.0
-
-