summaryrefslogtreecommitdiff
path: root/jstests/change_streams/required_as_first_stage.js
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:20:35 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-27 11:02:23 -0400
commit134a4083953270e8a11430395357fb70a29047ad (patch)
treedd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/change_streams/required_as_first_stage.js
parent1e46b5049003f427047e723ea5fab15b5a9253ca (diff)
downloadmongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/change_streams/required_as_first_stage.js')
-rw-r--r--jstests/change_streams/required_as_first_stage.js90
1 files changed, 44 insertions, 46 deletions
diff --git a/jstests/change_streams/required_as_first_stage.js b/jstests/change_streams/required_as_first_stage.js
index bdc0b43ba0c..2c5128f4865 100644
--- a/jstests/change_streams/required_as_first_stage.js
+++ b/jstests/change_streams/required_as_first_stage.js
@@ -5,50 +5,48 @@
// recognize the intentionally malformed aggergations that we test here.
// @tags: [change_stream_does_not_expect_txns]
(function() {
- "use strict";
-
- load("jstests/aggregation/extras/utils.js"); // For assertErrorCode.
- load("jstests/libs/collection_drop_recreate.js"); // For assert[Drop|Create]Collection.
-
- const coll = assertDropAndRecreateCollection(db, "change_stream_required_as_first_stage");
-
- assertErrorCode(coll, [{$match: {z: 34}}, {$changeStream: {}}], 40602);
- assertErrorCode(coll, [{$indexStats: {}}, {$changeStream: {}}], 40602);
- assertErrorCode(
- coll,
- [{$indexStats: {}}, {$changeStream: {}}, {$match: {test: "this is an extra stage"}}],
- 40602);
-
- let error = assert.throws(() => coll.aggregate([{$sort: {x: 1}}, {$changeStream: {}}]));
- assert.contains(error.code, [40602, 50988], "Unexpected error: " + tojson(error));
-
- error = assert.throws(
- () => coll.aggregate([{$sort: {x: 1}}, {$changeStream: {}}], {allowDiskUse: true}));
- assert.contains(error.code, [40602, 50988], "Unexpected error: " + tojson(error));
-
- error = assert.throws(() => coll.aggregate([{$group: {_id: "$x"}}, {$changeStream: {}}]));
- assert.contains(error.code, [40602, 50988], "Unexpected error: " + tojson(error));
-
- // This one has a different error code because of conflicting host type requirements: the $group
- // needs to merge on a shard, but the $changeStream needs to merge on mongos. This doesn't
- // happen for the $sort because the half of the $sort running on mongos is pre-sorted, and so
- // won't need disk space.
- error = assert.throws(
- () => coll.aggregate([{$group: {_id: "$x"}}, {$changeStream: {}}], {allowDiskUse: true}));
- assert.contains(
- error.code, [40602, ErrorCodes.IllegalOperation], "Unexpected error: " + tojson(error));
-
- // Test that a $changeStream stage is not allowed within a $facet stage.
- assertErrorCode(coll, [{$facet: {testPipe: [{$changeStream: {}}]}}], 40600);
- assertErrorCode(coll,
- [{
- $facet: {
- testPipe: [
- {$indexStats: {}},
- {$changeStream: {}},
- {$match: {test: "this is an extra stage"}}
- ]
- }
- }],
- 40600);
+"use strict";
+
+load("jstests/aggregation/extras/utils.js"); // For assertErrorCode.
+load("jstests/libs/collection_drop_recreate.js"); // For assert[Drop|Create]Collection.
+
+const coll = assertDropAndRecreateCollection(db, "change_stream_required_as_first_stage");
+
+assertErrorCode(coll, [{$match: {z: 34}}, {$changeStream: {}}], 40602);
+assertErrorCode(coll, [{$indexStats: {}}, {$changeStream: {}}], 40602);
+assertErrorCode(
+ coll,
+ [{$indexStats: {}}, {$changeStream: {}}, {$match: {test: "this is an extra stage"}}],
+ 40602);
+
+let error = assert.throws(() => coll.aggregate([{$sort: {x: 1}}, {$changeStream: {}}]));
+assert.contains(error.code, [40602, 50988], "Unexpected error: " + tojson(error));
+
+error = assert.throws(
+ () => coll.aggregate([{$sort: {x: 1}}, {$changeStream: {}}], {allowDiskUse: true}));
+assert.contains(error.code, [40602, 50988], "Unexpected error: " + tojson(error));
+
+error = assert.throws(() => coll.aggregate([{$group: {_id: "$x"}}, {$changeStream: {}}]));
+assert.contains(error.code, [40602, 50988], "Unexpected error: " + tojson(error));
+
+// This one has a different error code because of conflicting host type requirements: the $group
+// needs to merge on a shard, but the $changeStream needs to merge on mongos. This doesn't
+// happen for the $sort because the half of the $sort running on mongos is pre-sorted, and so
+// won't need disk space.
+error = assert.throws(
+ () => coll.aggregate([{$group: {_id: "$x"}}, {$changeStream: {}}], {allowDiskUse: true}));
+assert.contains(
+ error.code, [40602, ErrorCodes.IllegalOperation], "Unexpected error: " + tojson(error));
+
+// Test that a $changeStream stage is not allowed within a $facet stage.
+assertErrorCode(coll, [{$facet: {testPipe: [{$changeStream: {}}]}}], 40600);
+assertErrorCode(
+ coll,
+ [{
+ $facet: {
+ testPipe:
+ [{$indexStats: {}}, {$changeStream: {}}, {$match: {test: "this is an extra stage"}}]
+ }
+ }],
+ 40600);
}());