@@ -71,10 +71,8 @@ maybeDescribe('examples(change-stream):', function () {
7171 } ) ;
7272 // End Changestream Example 1
7373
74- // Start Changestream Example 1 Alternative
7574 const changeStreamIterator = collection . watch ( ) ;
7675 const next = await changeStreamIterator . next ( ) ;
77- // End Changestream Example 1 Alternative
7876
7977 await changeStream . close ( ) ;
8078 await changeStreamIterator . close ( ) ;
@@ -84,6 +82,25 @@ maybeDescribe('examples(change-stream):', function () {
8482 }
8583 } ) ;
8684
85+ it ( 'Open A Change Stream and use iteration methods' , {
86+ metadata : { requires : { topology : [ 'replicaset' ] , mongodb : '>=3.6.0' } } ,
87+ test : async function ( ) {
88+ const looper = new Looper ( ( ) => db . collection ( 'inventory' ) . insertOne ( { a : 1 } ) ) ;
89+ looper . run ( ) ;
90+
91+ // Start Changestream Example 1 Alternative
92+ const collection = db . collection ( 'inventory' ) ;
93+ const changeStream = collection . watch ( ) ;
94+ const next = await changeStream . next ( ) ;
95+ // End Changestream Example 1 Alternative
96+
97+ await changeStream . close ( ) ;
98+ await looper . stop ( ) ;
99+
100+ expect ( next ) . to . have . property ( 'operationType' ) . that . equals ( 'insert' ) ;
101+ }
102+ } ) ;
103+
87104 it ( 'Lookup Full Document for Update Operations' , {
88105 metadata : { requires : { topology : [ 'replicaset' ] , mongodb : '>=3.6.0' } } ,
89106 test : async function ( ) {
0 commit comments