Description
MongoDB is a source-available cross-platform document-oriented database program.Examples
Dependency:
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mongodb</artifactId>
<version>1.20.0</version>
<scope>test</scope>
</dependency>
Usage:
var mongoDBContainer = new MongoDBContainer(DockerImageName.parse("mongo:4.0.10"));
mongoDBContainer.start();
Dependency:
go get github.com/testcontainers/testcontainers-go/modules/mongodb
Usage:
mongoDBContainer, err := mongodb.Run(ctx, "mongo:6")
Dependency:
dotnet add package Testcontainers.MongoDb --version 3.9.0
Usage:
var mongoDbContainer = new MongoDbBuilder()
.WithImage("mongo:6.0")
.Build();
await mongoDbContainer.StartAsync();
Dependency:
npm install @testcontainers/mongodb --save-dev
Usage:
const mongodbContainer = await new MongoDBContainer().start();
Dependency:
pip install testcontainers[mongodb]
Usage:
with MongoDbContainer("mongo:7.0.7") as mongo:
db = mongo.get_connection_client()