Skip to content

Commit ed059eb

Browse files
committed
Updated location of the examples
JAVA-2751
1 parent f8d1082 commit ed059eb

21 files changed

+64
-38
lines changed

docs/reference/content/driver/getting-started/quick-start-pojo.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ title = "Quick Start - POJOs"
1313
{{% note %}}
1414
POJOs stands for Plain Old Java Objects.
1515

16-
The following code snippets come from the [`PojoQuickTour.java`]({{< srcref "driver/src/examples/tour/PojoQuickTour.java">}}) example code
16+
The following code snippets come from the [`PojoQuickTour.java`]({{< srcref "driver-sync/src/examples/tour/PojoQuickTour.java">}}) example code
1717
that can be found with the driver source on github.
1818
{{% /note %}}
1919

@@ -47,7 +47,7 @@ import static org.bson.codecs.configuration.CodecRegistries.fromProviders;
4747
import static org.bson.codecs.configuration.CodecRegistries.fromRegistries;
4848
```
4949

50-
- The following POJO classes. The full source is available on github for the [Person]({{< srcref "driver/src/examples/tour/Person.java">}}) and [Address]({{< srcref "driver/src/examples/tour/Address.java">}})
50+
- The following POJO classes. The full source is available on github for the [Person]({{< srcref "driver-sync/src/examples/tour/Person.java">}}) and [Address]({{< srcref "driver-sync/src/examples/tour/Address.java">}})
5151
POJOs. Here are the main implementation details:
5252

5353
```java

docs/reference/content/driver/getting-started/quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ title = "Quick Start"
1111
# MongoDB Driver Quick Start
1212

1313
{{% note %}}
14-
The following code snippets come from the [`QuickTour.java`]({{< srcref "driver/src/examples/tour/QuickTour.java">}}) example code
14+
The following code snippets come from the [`QuickTour.java`]({{< srcref "driver-sync/src/examples/tour/QuickTour.java">}}) example code
1515
that can be found with the driver source on github.
1616
{{% /note %}}
1717

docs/reference/content/driver/tutorials/gridfs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pre = "<i class='fa'></i>"
1515

1616
When you query a GridFS store for a file, the Java driver will reassemble the chunks as needed.
1717

18-
The following code snippets come from the [`GridFSTour.java`]({{< srcref "driver/src/examples/gridfs/GridFSTour.java">}}) example code
18+
The following code snippets come from the [`GridFSTour.java`]({{< srcref "driver-sync/src/examples/gridfs/GridFSTour.java">}}) example code
1919
that can be found with the driver source on github.
2020

2121
## Prerequisites

driver-legacy/src/examples/documentation/ChangeStreamSamples.java renamed to driver-sync/src/examples/documentation/ChangeStreamSamples.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package documentation;
1818

19-
import com.mongodb.MongoClient;
20-
import com.mongodb.MongoClientURI;
19+
import com.mongodb.client.MongoClient;
20+
import com.mongodb.client.MongoClients;
2121
import com.mongodb.client.MongoCollection;
2222
import com.mongodb.client.MongoCursor;
2323
import com.mongodb.client.MongoDatabase;
@@ -47,12 +47,11 @@ public final class ChangeStreamSamples {
4747
public static void main(final String[] args) {
4848
MongoClient mongoClient;
4949

50-
// Create a new MongoClient with a MongoDB URI string.
5150
if (args.length == 0) {
52-
// Defaults to a localhost replicaset on ports: 27017, 27018, 27019
53-
mongoClient = new MongoClient(new MongoClientURI("mongodb://localhost:27017,localhost:27018,localhost:27019"));
51+
// connect to the local database server
52+
mongoClient = MongoClients.create("mongodb://localhost:27017,localhost:27018,localhost:27019");
5453
} else {
55-
mongoClient = new MongoClient(new MongoClientURI(args[0]));
54+
mongoClient = MongoClients.create(args[0]);
5655
}
5756

5857
// Select the MongoDB database.

driver-legacy/src/examples/documentation/DocumentationSamples.java renamed to driver-sync/src/examples/documentation/DocumentationSamples.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package documentation;
1818

1919
import com.mongodb.Block;
20-
import com.mongodb.DatabaseTestCase;
20+
import com.mongodb.client.DatabaseTestCase;
2121
import com.mongodb.client.FindIterable;
2222
import com.mongodb.client.MongoCollection;
2323
import com.mongodb.client.MongoCursor;
@@ -39,8 +39,8 @@
3939

4040
import static com.mongodb.ClusterFixture.isDiscoverableReplicaSet;
4141
import static com.mongodb.ClusterFixture.serverVersionAtLeast;
42-
import static com.mongodb.Fixture.getDefaultDatabaseName;
43-
import static com.mongodb.Fixture.getMongoClient;
42+
import static com.mongodb.client.Fixture.getDefaultDatabaseName;
43+
import static com.mongodb.client.Fixture.getMongoClient;
4444
import static com.mongodb.client.model.Filters.all;
4545
import static com.mongodb.client.model.Filters.and;
4646
import static com.mongodb.client.model.Filters.elemMatch;

driver-legacy/src/examples/gridfs/GridFSTour.java renamed to driver-sync/src/examples/gridfs/GridFSTour.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
package gridfs;
1818

1919
import com.mongodb.Block;
20-
import com.mongodb.MongoClient;
21-
import com.mongodb.MongoClientURI;
20+
import com.mongodb.client.MongoClient;
21+
import com.mongodb.client.MongoClients;
2222
import com.mongodb.client.MongoDatabase;
2323
import com.mongodb.client.gridfs.GridFSBucket;
2424
import com.mongodb.client.gridfs.GridFSBuckets;
@@ -56,9 +56,9 @@ public static void main(final String[] args) throws FileNotFoundException, IOExc
5656

5757
if (args.length == 0) {
5858
// connect to the local database server
59-
mongoClient = new MongoClient();
59+
mongoClient = MongoClients.create();
6060
} else {
61-
mongoClient = new MongoClient(new MongoClientURI(args[0]));
61+
mongoClient = MongoClients.create(args[0]);
6262
}
6363

6464
// get handle to "mydb" database

driver-legacy/src/examples/primer/IndexesPrimer.java renamed to driver-sync/src/examples/primer/IndexesPrimer.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package primer;
1818

19-
2019
import org.junit.Test;
2120

2221
// @imports: start

0 commit comments

Comments
 (0)