/** * It is best to use a Mongo singleton instance here. * * @param mongoClient the representations of the connection to a MongoDB instance * @param dbName the name of the database * @return a Datastore that you can use to interact with MongoDB */ @SuppressWarnings("deprecation") public Datastore createDatastore(final MongoClient mongoClient, final String dbName) { return new DatastoreImpl(this, mongoClient, dbName); }
/** * Creates a new Datastore for interacting with MongoDB using POJOs * * @param mongoClient the representations of the connection to a MongoDB instance * @param mapper a pre-configured Mapper for your POJOs * @param dbName the name of the database * @return a Datastore that you can use to interact with MongoDB */ @SuppressWarnings("deprecation") public Datastore createDatastore(final MongoClient mongoClient, final Mapper mapper, final String dbName) { return new DatastoreImpl(this, mapper, mongoClient, dbName); }
/** * Creates a copy of this Datastore and all its configuration but with a new database * * @param database the new database to use for operations * @return the new Datastore instance * @deprecated use {@link Morphia#createDatastore(MongoClient, Mapper, String)} */ @Deprecated public DatastoreImpl copy(final String database) { return new DatastoreImpl(morphia, mapper, mongoClient, database); }