Skip to content
This repository was archived by the owner on Sep 18, 2024. It is now read-only.

Commit 6fa60c9

Browse files
committed
Updated README
1 parent a681cb4 commit 6fa60c9

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

README.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Repository to help getting started with MongoDB Java driver connecting to MongoD
44

55
## Information
66

7-
This Get-Started project uses [MongoDB Java driver](https://mongodb.github.io/mongo-java-driver/) version 4.1.1 by default. Although you can change the driver version, the provided code example was only tested against the default version of MongoDB driver. There is no guarantee that the code sample will work for all possible versions of the driver.
7+
This Get-Started project uses [MongoDB Java driver](https://mongodb.github.io/mongo-java-driver/) version 4.1.1 (sync) by default. Although you can change the driver version, the provided code example was only tested against the default version of MongoDB driver. There is no guarantee that the code sample will work for all possible versions of the driver.
88

99
## Pre-requisites
1010

@@ -16,7 +16,27 @@ Have Docker running on your machine. You can download and install from: https://
1616

1717
In order to execute the code example, you need to specify `MONGODB_URI` environment variable to connect to a MongoDB cluster. If you don't have any you can create one by signing up [MongoDB Atlas Free-tier M0](https://docs.atlas.mongodb.com/getting-started/).
1818

19-
## Build Steps
19+
## Execution Steps
20+
21+
1. Build Docker image with a tag name. Within the top level directory execute:
22+
```
23+
docker build . -t start-java
24+
```
25+
This will build a docker image with a tag name `start-java`.
26+
27+
2. Execute the helper shell script followed by the MongoDB URI that you would like to connect to.
28+
```
29+
./get-started.sh "mongodb+srv://usr:pwd@example.mongodb.net/dbname?retryWrites=true"
30+
```
31+
32+
To use a different driver version, specify the driver version after the MongoDB URI. For example:
33+
```
34+
./get-started.sh "mongodb+srv://usr:pwd@example.mongodb.net/dbname?retryWrites=true" 4.1.0
35+
```
36+
37+
## Alternative Execution Steps (without helper)
38+
39+
#### Build Steps
2040
2141
1. Build Docker image with a tag name. Within this directory execute:
2242
* To use the default driver version and specify `MONGODB_URI`:
@@ -37,14 +57,13 @@ In order to execute the code example, you need to specify `MONGODB_URI` environm
3757
3858
The command above will run a `start-java` tagged Docker image. Sets the hostname as `java`.
3959
40-
## Execution Steps
60+
#### Execution
4161
4262
1. Run the compiled Java code example by following below steps:
43-
* `cd ~/java`
4463
* `mvn package`
4564
* `java -cp ./target/start-1.0-SNAPSHOT.jar com.start.Getstarted`
4665
47-
### Change driver version from within the Docker environment
66+
#### Change driver version from within the Docker environment
4867
4968
You can change the version of `mongo-driver-sync` before code compilation time by modifying the [pom.xml: mongo-java-driver version](java/pom.xml#L11).
5069

0 commit comments

Comments
 (0)