Skip to content

Commit db35635

Browse files
dacharycdurran
andauthored
docs(NODE-5438): Improve naming in code example for documentation (mongodb#3769)
Co-authored-by: Durran Jordan <[email protected]>
1 parent 0d84d7a commit db35635

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

test/integration/node-specific/examples/change_streams.test.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)