-
Notifications
You must be signed in to change notification settings - Fork 21
HowTo basic setup
github-actions[bot] edited this page Oct 31, 2025
·
1 revision
Connect to a local MongoDB and configure Morphium.
MorphiumConfig cfg = new MorphiumConfig();
cfg.connectionSettings().setDatabase("myapp");
cfg.clusterSettings().addHostToSeed("localhost", 27017);
Morphium morphium = new Morphium(cfg);Replica set example
cfg.clusterSettings().addHostToSeed("mongo1", 27017);
cfg.clusterSettings().addHostToSeed("mongo2", 27017);
cfg.clusterSettings().addHostToSeed("mongo3", 27017);Authentication
cfg.authSettings().setMongoLogin("user");
cfg.authSettings().setMongoPassword("secret");Driver selection (optional)
cfg.driverSettings().setDriverName("PooledDriver"); // default