summaryrefslogtreecommitdiff
path: root/jstests/aggregation/sources/unset/unset.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/aggregation/sources/unset/unset.js
parent1e46b5049003f427047e723ea5fab15b5a9253ca (diff)
downloadmongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/aggregation/sources/unset/unset.js')
-rw-r--r--jstests/aggregation/sources/unset/unset.js55
1 files changed, 27 insertions, 28 deletions
diff --git a/jstests/aggregation/sources/unset/unset.js b/jstests/aggregation/sources/unset/unset.js
index be20a69b362..c11f97598f5 100644
--- a/jstests/aggregation/sources/unset/unset.js
+++ b/jstests/aggregation/sources/unset/unset.js
@@ -1,39 +1,38 @@
// Basic testing for the $unset aggregation stage.
(function() {
- "use strict";
+"use strict";
- load("jstests/aggregation/extras/utils.js"); // For assertArrayEq.
+load("jstests/aggregation/extras/utils.js"); // For assertArrayEq.
- const coll = db.agg_stage_unset;
- coll.drop();
+const coll = db.agg_stage_unset;
+coll.drop();
- assert.commandWorked(coll.insert(
- [{_id: 0, a: 10}, {_id: 1, a: {b: 20, c: 30, 0: 40}}, {_id: 2, a: [{b: 50, c: 60}]}]));
+assert.commandWorked(coll.insert(
+ [{_id: 0, a: 10}, {_id: 1, a: {b: 20, c: 30, 0: 40}}, {_id: 2, a: [{b: 50, c: 60}]}]));
- // unset single field.
- let result = coll.aggregate([{$unset: ["a"]}]).toArray();
- assertArrayEq({actual: result, expected: [{_id: 0}, {_id: 1}, {_id: 2}]});
+// unset single field.
+let result = coll.aggregate([{$unset: ["a"]}]).toArray();
+assertArrayEq({actual: result, expected: [{_id: 0}, {_id: 1}, {_id: 2}]});
- // unset should work with string directive.
- result = coll.aggregate([{$unset: "a"}]).toArray();
- assertArrayEq({actual: result, expected: [{_id: 0}, {_id: 1}, {_id: 2}]});
+// unset should work with string directive.
+result = coll.aggregate([{$unset: "a"}]).toArray();
+assertArrayEq({actual: result, expected: [{_id: 0}, {_id: 1}, {_id: 2}]});
- // unset multiple fields.
- result = coll.aggregate([{$unset: ["_id", "a"]}]).toArray();
- assertArrayEq({actual: result, expected: [{}, {}, {}]});
+// unset multiple fields.
+result = coll.aggregate([{$unset: ["_id", "a"]}]).toArray();
+assertArrayEq({actual: result, expected: [{}, {}, {}]});
- // unset with dotted field path.
- result = coll.aggregate([{$unset: ["a.b"]}]).toArray();
- assertArrayEq({
- actual: result,
- expected: [{_id: 0, a: 10}, {_id: 1, a: {0: 40, c: 30}}, {_id: 2, a: [{c: 60}]}]
- });
-
- // Numeric field paths in aggregation represent field name only and not array offset.
- result = coll.aggregate([{$unset: ["a.0"]}]).toArray();
- assertArrayEq({
- actual: result,
- expected: [{_id: 0, a: 10}, {_id: 1, a: {b: 20, c: 30}}, {_id: 2, a: [{b: 50, c: 60}]}]
- });
+// unset with dotted field path.
+result = coll.aggregate([{$unset: ["a.b"]}]).toArray();
+assertArrayEq({
+ actual: result,
+ expected: [{_id: 0, a: 10}, {_id: 1, a: {0: 40, c: 30}}, {_id: 2, a: [{c: 60}]}]
+});
+// Numeric field paths in aggregation represent field name only and not array offset.
+result = coll.aggregate([{$unset: ["a.0"]}]).toArray();
+assertArrayEq({
+ actual: result,
+ expected: [{_id: 0, a: 10}, {_id: 1, a: {b: 20, c: 30}}, {_id: 2, a: [{b: 50, c: 60}]}]
+});
})();