File tree Expand file tree Collapse file tree 6 files changed +24
-7
lines changed Expand file tree Collapse file tree 6 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ Additional Information
6161API Documentation
6262~~~~~~~~~~~~~~~~~
6363
64- For additional information on the classes and methods used to run database commands, see the following API documentation:
64+ For additional information on the method used to run database commands, see the following API documentation:
6565
6666- `runCommand() <{+api+}/apidocs/mongodb-driver-sync/com/mongodb/client/MongoDatabase.html#runCommand(org.bson.conversions.Bson)>`__
6767
Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ Count Documents
1111 :depth: 2
1212 :class: singlecol
1313
14- In this guide, you can learn how to count documents in your MongoDB
15- database collection. There are two instance methods in the ``MongoCollection``
16- class that you can call to count the number of documents in a collection:
14+ In this guide, you can learn how to count the number of documents in your
15+ MongoDB database collections. There are two instance methods in the
16+ ``MongoCollection`` class that you can call to count the number of documents in
17+ a collection:
1718
1819- ``countDocuments()`` returns the number of documents in the collection
1920 that match a specified query. If you specify an empty query filter,
@@ -83,13 +84,13 @@ Both methods return the number of matching documents as a ``long`` primitive.
8384Count Documents Example: Full File
8485----------------------------------
8586
87+ .. include:: /includes/crud/example-intro.rst
88+
8689The following example estimates the number of documents in the
8790``movies`` collection in the ``sample_mflix`` database, and then returns
8891an accurate count of the number of documents in the ``movies``
8992collection with ``Canada`` in the ``countries`` field.
9093
91- .. include:: /includes/connect-guide-note.rst
92-
9394.. literalinclude:: /includes/crud/CountDocuments.java
9495 :language: java
9596
Original file line number Diff line number Diff line change 1+ // Runs a database command by using the Java driver
2+
13package org .example ;
24
35import org .bson .BsonDocument ;
Original file line number Diff line number Diff line change 1- // Runs count operations on a collection by using the Java driver
1+ /**
2+ * This file demonstrates how to open a change stream by using the Java driver.
3+ * It connects to a MongoDB deployment, accesses the "sample_mflix" database, and listens
4+ * to change events in the "movies" collection. The code uses a change stream with a pipeline
5+ * to only filter for "insert" and "update" events.
6+ */
27
38package usage .examples ;
49
Original file line number Diff line number Diff line change 1+ /**
2+ * This file demonstrates how to open a change stream by using the Java driver.
3+ * It connects to a MongoDB deployment, accesses the "sample_mflix" database, and listens
4+ * to change events in the "movies" collection. The code uses a change stream with a pipeline
5+ * to only filter for "insert" and "update" events.
6+ */
7+
18package org .example ;
29
310import java .util .Arrays ;
Original file line number Diff line number Diff line change 1+ // Performs CRUD operations to generate change events when run with the Watch application
2+
13package org .example ;
24
35import org .bson .Document ;
You can’t perform that action at this time.
0 commit comments