Skip to content

Commit 793dc70

Browse files
committed
Merge branch 'v4.11' of github.com:mongodb/docs-java into v4.11
2 parents 7522203 + d62f3e8 commit 793dc70

File tree

4 files changed

+43
-24
lines changed

4 files changed

+43
-24
lines changed

source/fundamentals/builders/aggregates.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
Aggregates Builders
33
===================
44

5+
.. facet::
6+
:name: genre
7+
:values: reference
8+
9+
.. meta::
10+
:keywords: code examples
11+
512
.. contents:: On this page
613
:local:
714
:backlinks: none

source/fundamentals/connection/jndi.txt

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ Connect to MongoDB by Using a JNDI Datasource
1010
:depth: 2
1111
:class: singlecol
1212

13+
.. facet::
14+
:name: genre
15+
:values: tutorial
16+
17+
.. meta::
18+
:keywords: code example, wildfly, tomcat
1319

1420
Overview
1521
--------
@@ -31,9 +37,15 @@ JNDI Datasource.
3137
:tabid: wildfly
3238

3339
1. In a `Wildfly <https://wildfly.org/>`__ installation, create a new module
34-
for MongoDB at ``modules/system/layers/base/org/mongodb/main``. Copy the
35-
``mongo-java-driver.jar`` jar file into the module. Add the following
36-
``module.xml`` file into the module:
40+
for MongoDB at ``modules/system/layers/base/org/mongodb/main``. Copy
41+
the following jar files into the module:
42+
43+
- ``mongodb-driver-sync-{+full-version+}.jar``
44+
- ``mongodb-driver-core-{+full-version+}.jar``
45+
- ``bson-{+full-version+}.jar``
46+
- ``bson-record-codec-{+full-version+}.jar``
47+
48+
Add the following ``module.xml`` file into the module:
3749

3850
.. literalinclude:: /includes/fundamentals/code-snippets/wildfly-module-with-version.xml
3951
:language: xml
@@ -67,8 +79,13 @@ JNDI Datasource.
6779
.. tab:: Tomcat
6880
:tabid: tomcat
6981

70-
1. Copy the ``mongo-java-driver.jar`` jar file into the ``lib`` directory
71-
of your `Tomcat <https://tomcat.apache.org/>`__ installation.
82+
1. Copy the following jar files into the ``lib`` directory
83+
of your `Tomcat <https://tomcat.apache.org/>`__ installation:
84+
85+
- ``mongodb-driver-sync-{+full-version+}.jar``
86+
- ``mongodb-driver-core-{+full-version+}.jar``
87+
- ``bson-{+full-version+}.jar``
88+
- ``bson-record-codec-{+full-version+}.jar``
7289

7390
#. In the ``context.xml`` file of your application, add a resource that references
7491
the ``MongoClientFactory`` class and the :ref:`connection string
@@ -78,7 +95,7 @@ JNDI Datasource.
7895

7996
<Resource name="mongodb/MyMongoClient"
8097
auth="Container"
81-
type="com.mongodb.MongoClient"
98+
type="com.mongodb.client.MongoClient"
8299
closeMethod="close"
83100
factory="com.mongodb.client.MongoClientFactory"
84101
singleton="true"

source/includes/fundamentals/code-snippets/builders/AggBuilders.java

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ public static void main(String[] args) {
8282
page.bucketAutoOptionsStage();
8383
page.facetStage();
8484
page.vectorSearchPipeline();
85-
// Fix required: https://jira.mongodb.org/browse/DOCSP-33327
86-
// page.setWindowFieldsStage();
85+
page.setWindowFieldsStage();
8786
page.aggregationExample();
8887
}
8988

@@ -95,16 +94,14 @@ private void aggregationExample() {
9594
// end aggregationSample
9695
}
9796

98-
/* Fix required: https://jira.mongodb.org/browse/DOCSP-33327
9997
private void setWindowFieldsStage() {
10098
// begin setWindowFields
10199
Window pastMonth = Windows.timeRange(-1, MongoTimeUnit.MONTH, Windows.Bound.CURRENT);
102100
setWindowFields("$localityId", Sorts.ascending("measurementDateTime"),
103-
WindowedComputations.sum("monthlyRainfall", "$rainfall", pastMonth),
104-
WindowedComputations.avg("monthlyAvgTemp", "$temperature", pastMonth));
101+
WindowOutputFields.sum("monthlyRainfall", "$rainfall", pastMonth),
102+
WindowOutputFields.avg("monthlyAvgTemp", "$temperature", pastMonth));
105103
// end setWindowFields
106104
}
107-
*/
108105

109106
private void facetStage() {
110107
// begin facet
@@ -258,10 +255,11 @@ private void advancedLookupStage() {
258255
Bson innerJoinLookup = lookup("warehouses", variables, pipeline, "stockdata");
259256
// end advanced lookup
260257
// Missing advancedLookup assignment
261-
// MongoCursor<Document> cursor = collection.aggregate(asList(advancedLookup)).cursor();
262-
// cursor.forEachRemaining(doc -> System.out.println(doc.toJson()));
263-
// database = mongoClient.getDatabase("sample_mflix");
264-
// collection = database.getCollection("movies");
258+
// MongoCursor<Document> cursor =
259+
// collection.aggregate(asList(advancedLookup)).cursor();
260+
// cursor.forEachRemaining(doc -> System.out.println(doc.toJson()));
261+
// database = mongoClient.getDatabase("sample_mflix");
262+
// collection = database.getCollection("movies");
265263
}
266264

267265
private void basicLookupStage() {
@@ -332,7 +330,7 @@ private void vectorSearchPipeline() {
332330
limit,
333331
options),
334332
project(
335-
metaVectorSearchScore("vectorSearchScore")));
333+
metaVectorSearchScore("vectorSearchScore")));
336334
// end vectorSearch
337335

338336
// begin vectorSearch-output
@@ -345,7 +343,6 @@ private void vectorSearchPipeline() {
345343
// Example output: "vectorSearch score: 0.887437105178833"
346344
}
347345

348-
349346
private void documentsStage() {
350347
// begin documents
351348
documents(asList(

source/whats-new.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,13 @@ Learn what's new in:
2929

3030
.. _upcoming-breaking-changes:
3131

32-
Upcoming Breaking Changes
33-
-------------------------
32+
.. Upcoming Breaking Changes
33+
-------------------------
3434

3535
.. Relocate these items into the source/upgrade.txt page once they become breaking changes
3636

37-
In addition to the deprecations mentioned in specific driver versions on this
38-
page, anticipated breaking changes include the following:
39-
40-
- Beginning with v5.0, the {+driver-short+} requires Java 11 or later.
37+
.. In addition to the deprecations mentioned in specific driver versions on this
38+
page, anticipated breaking changes include the following:
4139

4240
.. _version-4.11:
4341

0 commit comments

Comments
 (0)