File tree Expand file tree Collapse file tree 2 files changed +24
-3
lines changed
code-snippets/usage-examples Expand file tree Collapse file tree 2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,9 @@ async function run() {
31
31
} ) ;
32
32
// wait to close `changeStream` after the listener receives the event
33
33
setTimeout ( async ( ) => {
34
- resolve ( await changeStream . close ( ) ) ;
34
+ resolve (
35
+ await changeStream . close ( ( ) => console . log ( "closed the change stream" ) )
36
+ ) ;
35
37
} , 1000 ) ;
36
38
} , 1000 ) ;
37
39
} ) ;
Original file line number Diff line number Diff line change @@ -106,8 +106,26 @@ callback process the event before exiting.
106
106
107
107
.. include:: /includes/connect-guide-note.rst
108
108
109
- .. literalinclude:: /code-snippets/usage-examples/changeStream.js
110
- :language: javascript
109
+ .. tabs::
110
+
111
+ .. tab:: JavaScript
112
+ :tabid: javascript
113
+
114
+ .. literalinclude:: /code-snippets/usage-examples/changeStream.js
115
+ :language: javascript
116
+ :linenos:
117
+
118
+ .. tab:: TypeScript
119
+ :tabid: typescript
120
+
121
+ .. literalinclude:: /code-snippets/usage-examples/changeStream.js
122
+ :language: javascript
123
+ :linenos:
124
+
125
+ .. note:: Identical Code Snippets
126
+
127
+ The JavaScript and TypeScript code snippets above are identical. There are no
128
+ TypeScript specific features of the driver relevant to this use case.
111
129
112
130
If you run the example above, you should see output similar to the
113
131
following:
@@ -124,6 +142,7 @@ following:
124
142
ns: { db: 'sample_mflix', coll: 'movies' },
125
143
documentKey: { _id: 5ec3... },
126
144
}
145
+ closed the change stream
127
146
128
147
.. note:: Receive Full Documents From Updates
129
148
You can’t perform that action at this time.
0 commit comments