Skip to content

Embedded MongoDB for unit testing purposes based on flapdoodle-oss/de.flapdoodle.embed.mongo

License

Notifications You must be signed in to change notification settings

svenkubiak/embedded-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maven Central Coverage

embedded-mongodb

Embedded MongoDB for unit testing and developement purposes. Based on flapdoodle-oss/de.flapdoodle.embed.mongo

7.x requires Java 17.

8.x requires Java 21.

Usage

  1. Add the embedded-mongodb dependency to your pom.xml:
<dependency>
    <groupId>de.svenkubiak</groupId>
    <artifactId>embedded-mongodb</artifactId>
    <version>x.x.x</version>
</dependency>
  1. Start the embedded MongoDB by calling the following method
EmeddedMongoDB.create().start();

This will start an in-memory MongoDB with default options at localhost on port 29019 with the latest "production" version of Mongo DB.

Additional options

EmbeddedMongoDB embeddedMongoDB = EmbeddedMongoDB.create()
    .withHost("localhost")
    .withPort(27017)
    .withVersion(Main.V3_6)
    .start();
    
if (embeddedMongoDB.isActive()) {
	//do something
}

About

Embedded MongoDB for unit testing purposes based on flapdoodle-oss/de.flapdoodle.embed.mongo

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published