File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Expand file tree Collapse file tree 2 files changed +11
-15
lines changed 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-
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
152package usage .examples ;
163
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments