@@ -8,7 +8,7 @@ title = "Change Streams"
88 pre = " <i class='fa'></i>"
99+++
1010
11- ## Change Streams - Draft
11+ ## Change Streams
1212
1313MongoDB 3.6 introduces a new [ ` $changeStream ` ] ( http://dochub.mongodb.org/core/changestreams ) aggregation pipeline
1414operator.
@@ -74,14 +74,40 @@ For additional information on connecting to MongoDB, see [Connect to MongoDB]({{
7474
7575## Watch the collection
7676
77- To create a change stream use the the [ ` MongoCollection.watch() ` ] ({{<apiref "com/mongodb/client/MongoCollection.html#watch">}}) method.
77+ To create a change stream use one the [ ` MongoCollection.watch() ` ] ({{<apiref "com/mongodb/async/client/MongoCollection.html#watch">}})
78+ methods.
7879
7980In the following example, the change stream prints out all changes it observes.
8081
8182``` java
8283collection. watch(). forEach(printBlock, callbackWhenFinished);
8384```
8485
86+ ## Watch the database
87+
88+ New in the 3.8 driver and MongoDB 4.0, applications can open a single change stream to watch all non-system collections of a database. To
89+ create such a change stream use one of the [ ` MongoDatabase.watch() ` ] ({{<apiref "com/mongodb/async/client/MongoDatabase.html#watch">}})
90+ methods.
91+
92+ In the following example, the change stream prints out all the changes it observes on the given database.
93+
94+ ``` java
95+ database. watch(). forEach(printBlock, callbackWhenFinished);
96+ ```
97+
98+ ## Watch all databases
99+
100+ New in the 3.8 driver and MongoDB 4.0, applications can open a single change stream to watch all non-system collections of all databases
101+ in a MongoDB deployment. To create such a change stream use one of the
102+ [ ` MongoClient.watch() ` ] ({{<apiref "com/mongodb/async/client/MongoClient.html#watch">}}) methods.
103+
104+ In the following example, the change stream prints out all the changes it observes on the deployement to which the ` MongoClient ` is
105+ connected
106+
107+ ``` java
108+ mongoClient. watch(). forEach(printBlock, callbackWhenFinished);
109+ ```
110+
85111## Filtering content
86112
87113The ` watch ` method can also be passed a list of [ aggregation stages] ({{< docsref "meta/aggregation-quick-reference" >}}), that can modify
0 commit comments