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() {
3131 } ) ;
3232 // wait to close `changeStream` after the listener receives the event
3333 setTimeout ( async ( ) => {
34- resolve ( await changeStream . close ( ) ) ;
34+ resolve (
35+ await changeStream . close ( ( ) => console . log ( "closed the change stream" ) )
36+ ) ;
3537 } , 1000 ) ;
3638 } , 1000 ) ;
3739 } ) ;
Original file line number Diff line number Diff line change @@ -106,8 +106,26 @@ callback process the event before exiting.
106106
107107.. include:: /includes/connect-guide-note.rst
108108
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.
111129
112130If you run the example above, you should see output similar to the
113131following:
@@ -124,6 +142,7 @@ following:
124142 ns: { db: 'sample_mflix', coll: 'movies' },
125143 documentKey: { _id: 5ec3... },
126144 }
145+ closed the change stream
127146
128147.. note:: Receive Full Documents From Updates
129148
You can’t perform that action at this time.
0 commit comments