Skip to content

Commit d8aee63

Browse files
committed
run command
1 parent 32179bd commit d8aee63

File tree

6 files changed

+24
-7
lines changed

6 files changed

+24
-7
lines changed

source/command.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Additional Information
6161
API 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

source/crud/read-operations/count.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff 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.
8384
Count Documents Example: Full File
8485
----------------------------------
8586

87+
.. include:: /includes/crud/example-intro.rst
88+
8689
The following example estimates the number of documents in the
8790
``movies`` collection in the ``sample_mflix`` database, and then returns
8891
an accurate count of the number of documents in the ``movies``
8992
collection 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

source/includes/RunCommand.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Runs a database command by using the Java driver
2+
13
package org.example;
24

35
import org.bson.BsonDocument;

source/includes/crud/CountDocuments.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
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

38
package usage.examples;
49

source/includes/crud/Watch.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
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+
18
package org.example;
29

310
import java.util.Arrays;

source/includes/crud/WatchCompanion.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Performs CRUD operations to generate change events when run with the Watch application
2+
13
package org.example;
24

35
import org.bson.Document;

0 commit comments

Comments
 (0)