summaryrefslogtreecommitdiff
path: root/jstests/sharding/change_stream_lookup_single_shard_cluster.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/sharding/change_stream_lookup_single_shard_cluster.js')
-rw-r--r--jstests/sharding/change_stream_lookup_single_shard_cluster.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/jstests/sharding/change_stream_lookup_single_shard_cluster.js b/jstests/sharding/change_stream_lookup_single_shard_cluster.js
index 02766b7b592..f642064cd57 100644
--- a/jstests/sharding/change_stream_lookup_single_shard_cluster.js
+++ b/jstests/sharding/change_stream_lookup_single_shard_cluster.js
@@ -36,14 +36,21 @@
assert.eq(explainPlan.mergeType, "mongos");
// Open a $changeStream on the collection with 'updateLookup' and update the test doc.
- const stream = mongosColl.aggregate([{$changeStream: {fullDocument: "updateLookup"}}]);
+ const stream = mongosColl.watch([], {fullDocument: "updateLookup"});
+ const wholeDbStream = mongosDB.watch([], {fullDocument: "updateLookup"});
+
mongosColl.update({_id: 1}, {$set: {updated: true}});
- // Verify that the document is successfully retrieved from the sharded collection.
+ // Verify that the document is successfully retrieved from the single-collection and whole-db
+ // change streams.
assert.soon(() => stream.hasNext());
assert.docEq(stream.next().fullDocument, {_id: 1, updated: true});
+ assert.soon(() => wholeDbStream.hasNext());
+ assert.docEq(wholeDbStream.next().fullDocument, {_id: 1, updated: true});
+
stream.close();
+ wholeDbStream.close();
st.stop();
-})(); \ No newline at end of file
+})();