Skip to content

Commit a35637f

Browse files
committed
change stream
1 parent 17aacbd commit a35637f

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

source/includes/crud/Watch.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,3 @@
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-
8-
/**
9-
* This file demonstrates how to open a change stream by using the Java driver.
10-
* It connects to a MongoDB deployment, accesses the "sample_mflix" database, and listens
11-
* to change events in the "movies" collection. The code uses a change stream with a pipeline
12-
* to only filter for "insert" and "update" events.
13-
*/
141

152
package usage.examples;
163

source/logging-monitoring/change-streams.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,17 @@ Watch Example: Full File
9595

9696
.. include:: /includes/crud/example-intro.rst
9797

98-
The following code is a complete, standalone file that performs an ordered bulk
99-
write operation.
98+
This file demonstrates how to open a change stream by using the watch method.
99+
The watch method takes a pipeline as an argument to filter for only ``"insert"``
100+
and ``"update"`` events. When an insert or update event occurs on the watched
101+
collection, a log of the even is printed to the screen.
102+
103+
To see output in your terminal:
104+
105+
#. Run the file in your editor.
106+
#. Insert or update a document in the ``sample_mflix`` database ``movies`` collection.
107+
- You can insert or update documents by using :atlas:`Atlas
108+
</documents/#create--view--update--and-delete-documents>` or :mongosh:`mongosh </crud/>`.
100109

101110
.. io-code-block::
102111

0 commit comments

Comments
 (0)