@@ -82,20 +82,6 @@ methods presented above:
82
82
- :node-api-4.0:`Db.watch() </classes/db.html#watch>`,
83
83
- :node-api-4.0:`MongoClient.watch() API documentation </classes/mongoclient.html#watch>`
84
84
85
- .. note::
86
-
87
- Change events that contain information on update operations only return the modified
88
- fields by default rather than the full updated document. You can configure
89
- your change stream to also return the most current version of the document
90
- by setting the ``fullDocument`` field of the options object to
91
- ``"updateLookup"`` as follows:
92
-
93
- .. code-block:: javascript
94
-
95
- const changeStream = collection.watch();
96
- const options = { fullDocument: "updateLookup" };
97
- changeStream.on("change", callbackFunction, options);
98
-
99
85
Example
100
86
-------
101
87
@@ -141,3 +127,21 @@ following:
141
127
ns: { db: 'sample_mflix', coll: 'movies' },
142
128
documentKey: { _id: 5ec3... },
143
129
}
130
+
131
+ .. note:: Receive Full Documents From Updates
132
+
133
+ Change events that contain information on update operations only return the modified
134
+ fields by default rather than the full updated document. You can configure
135
+ your change stream to also return the most current version of the document
136
+ by setting the ``fullDocument`` field of the options object to
137
+ ``"updateLookup"`` as follows:
138
+
139
+ .. code-block:: javascript
140
+ :emphasize-lines: 1, 5
141
+
142
+ const options = { fullDocument: "updateLookup" };
143
+ // This could be any pipeline.
144
+ const pipeline = [];
145
+
146
+ const changeStream = collection.watch(pipeline, options);
147
+
0 commit comments