You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/modules/databases/mongodb.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,20 +3,23 @@
3
3
!!! note
4
4
This module is INCUBATING. While it is ready for use and operational in the current version of Testcontainers, it is possible that it may receive breaking changes in the future. See [our contributing guidelines](/contributing/#incubating-modules) for more information on our incubating modules policy.
5
5
6
-
# Java8 MongoDbContainer for constructing a single node MongoDB replica set. To construct a multi-node MongoDB cluster, consider the [mongodb-replica-set project](https://github.com/silaev/mongodb-replica-set/)
7
-
8
6
## Usage example
9
7
10
-
The following example shows how to create a MongoDbContainer
8
+
The following example shows how to create a MongoDBContainer:
11
9
12
10
<!--codeinclude-->
13
-
[Creating a MongoDB container](../../../modules/mongodb/src/test/java/org/testcontainers/containers/MongoDbContainerTest.java) inside_block:creatingMongoDbContainer
11
+
[Creating a MongoDB container](../../../modules/mongodb/src/test/java/org/testcontainers/containers/MongoDBContainerTest.java) inside_block:creatingMongoDBContainer
14
12
<!--/codeinclude-->
15
13
14
+
And how to start it:
15
+
16
16
<!--codeinclude-->
17
-
[Starting a MongoDB container](../../../modules/mongodb/src/test/java/org/testcontainers/containers/MongoDbContainerTest.java) inside_block:startingMongoDbContainer
17
+
[Starting a MongoDB container](../../../modules/mongodb/src/test/java/org/testcontainers/containers/MongoDBContainerTest.java) inside_block:startingMongoDBContainer
18
18
<!--/codeinclude-->
19
19
20
+
!!! note
21
+
To construct a multi-node MongoDB cluster, consider the [mongodb-replica-set project](https://github.com/silaev/mongodb-replica-set/)
22
+
20
23
#### Motivation
21
24
Implement a reusable, cross-platform, simple to install solution that doesn't depend on
22
25
fixed ports to test MongoDB transactions.
@@ -31,7 +34,7 @@ For instance, to initialize a single node replica set on fixed ports via Docker,
31
34
* Provide a special url for a user to employ with a MongoDB driver without specifying replicaSet
32
35
33
36
As we can see, there is a lot of operations to execute and we even haven't touched a non-fixed port approach.
34
-
That's where the MongoDbContainer might come in handy.
37
+
That's where the MongoDBContainer might come in handy.
35
38
36
39
## Adding this module to your project dependencies
Copy file name to clipboardExpand all lines: modules/mongodb/src/main/java/org/testcontainers/containers/MongoDBContainer.java
+8-24Lines changed: 8 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -11,30 +11,28 @@
11
11
/**
12
12
* Constructs a single node MongoDB replica set for testing transactions.
13
13
* <p>To construct a multi-node MongoDB cluster, consider the <a href="https://github.com/silaev/mongodb-replica-set/">mongodb-replica-set project on GitHub</a>
14
-
* <p>Tested on a Mongo DB version 4.0.10+ (that is the default version if not specified).
15
-
*
16
-
* @author Konstantin Silaev on 9/30/2019
14
+
* <p>Tested on a MongoDB version 4.0.10+ (that is the default version if not specified).
0 commit comments