summaryrefslogtreecommitdiff
path: root/jstests/core/batch_write_collation_estsize.js
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:42:24 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-26 18:42:24 -0400
commitc1a45ebbb0530e3d0201321d725527f1eb83ffce (patch)
treef523079dc5ded3052eefbdcaae424b7502df5b25 /jstests/core/batch_write_collation_estsize.js
parentc9599d8610c3da0b7c3da65667aff821063cf5b9 (diff)
downloadmongo-c1a45ebbb0530e3d0201321d725527f1eb83ffce.tar.gz
Apply formatting per `clang-format-7.0.1`
Diffstat (limited to 'jstests/core/batch_write_collation_estsize.js')
-rw-r--r--jstests/core/batch_write_collation_estsize.js346
1 files changed, 169 insertions, 177 deletions
diff --git a/jstests/core/batch_write_collation_estsize.js b/jstests/core/batch_write_collation_estsize.js
index 819060ec37e..d0e4254d6b2 100644
--- a/jstests/core/batch_write_collation_estsize.js
+++ b/jstests/core/batch_write_collation_estsize.js
@@ -7,186 +7,178 @@
// specification in the write operation document.
(function() {
- "use strict";
-
- // Setup the test collection.
- db.batch_write_collation_estsize.drop();
- assert.writeOK(db.batch_write_collation_estsize.insert({str: "FOO"}));
-
- if (db.getMongo().writeMode() !== "commands") {
- // Cannot use the bulk API to set a collation when using legacy write ops.
- let bulk;
-
- // Test updateOne unordered bulk write operation with collation specification.
- bulk = db.batch_write_collation_estsize.initializeUnorderedBulkOp();
- assert.throws(() => {
- bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).updateOne({
- str: "BAR"
- });
- });
-
- // Test update unordered bulk write operation with collation specification.
- bulk = db.batch_write_collation_estsize.initializeUnorderedBulkOp();
- assert.throws(() => {
- bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).update({str: "BAR"});
- });
-
- // Test replaceOne unordered bulk write operation with collation specification.
- bulk = db.batch_write_collation_estsize.initializeUnorderedBulkOp();
- assert.throws(() => {
- bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).replaceOne({
- str: "BAR"
- });
- });
-
- // Test removeOne unordered bulk write operation with collation specification.
- bulk = db.batch_write_collation_estsize.initializeUnorderedBulkOp();
- assert.throws(() => {
- bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).removeOne();
- });
-
- // Test remove unordered bulk write operation with collation specification.
- bulk = db.batch_write_collation_estsize.initializeUnorderedBulkOp();
- assert.throws(() => {
- bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).remove();
- });
-
- // Test updateOne ordered bulk write operation with collation specification.
- bulk = db.batch_write_collation_estsize.initializeOrderedBulkOp();
- assert.throws(() => {
- bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).updateOne({
- str: "BAR"
- });
- });
-
- // Test update ordered bulk write operation with collation specification.
- bulk = db.batch_write_collation_estsize.initializeOrderedBulkOp();
- assert.throws(() => {
- bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).update({str: "BAR"});
- });
-
- // Test replaceOne ordered bulk write operation with collation specification.
- bulk = db.batch_write_collation_estsize.initializeOrderedBulkOp();
- assert.throws(() => {
- bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).replaceOne({
- str: "BAR"
- });
- });
-
- // Test removeOne ordered bulk write operation with collation specification.
- bulk = db.batch_write_collation_estsize.initializeOrderedBulkOp();
- assert.throws(() => {
- bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).removeOne();
- });
-
- // Test remove ordered bulk write operation with collation specification.
- bulk = db.batch_write_collation_estsize.initializeOrderedBulkOp();
- assert.throws(() => {
- bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).remove();
- });
- } else {
- // Setup the bulk write response variable.
- let res;
-
- // Test updateOne bulk write operation with collation specification.
- res = db.batch_write_collation_estsize.bulkWrite([{
- updateOne: {
- filter: {str: "FOO"},
- update: {$set: {str: "BAR"}},
- collation: {
- locale: "en_US",
- caseLevel: false,
- caseFirst: "off",
- strength: 3,
- numericOrdering: false,
- alternate: "non-ignorable",
- maxVariable: "punct",
- normalization: false,
- backwards: false
- }
+"use strict";
+
+// Setup the test collection.
+db.batch_write_collation_estsize.drop();
+assert.writeOK(db.batch_write_collation_estsize.insert({str: "FOO"}));
+
+if (db.getMongo().writeMode() !== "commands") {
+ // Cannot use the bulk API to set a collation when using legacy write ops.
+ let bulk;
+
+ // Test updateOne unordered bulk write operation with collation specification.
+ bulk = db.batch_write_collation_estsize.initializeUnorderedBulkOp();
+ assert.throws(() => {
+ bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).updateOne({str: "BAR"});
+ });
+
+ // Test update unordered bulk write operation with collation specification.
+ bulk = db.batch_write_collation_estsize.initializeUnorderedBulkOp();
+ assert.throws(() => {
+ bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).update({str: "BAR"});
+ });
+
+ // Test replaceOne unordered bulk write operation with collation specification.
+ bulk = db.batch_write_collation_estsize.initializeUnorderedBulkOp();
+ assert.throws(() => {
+ bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).replaceOne({str: "BAR"});
+ });
+
+ // Test removeOne unordered bulk write operation with collation specification.
+ bulk = db.batch_write_collation_estsize.initializeUnorderedBulkOp();
+ assert.throws(() => {
+ bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).removeOne();
+ });
+
+ // Test remove unordered bulk write operation with collation specification.
+ bulk = db.batch_write_collation_estsize.initializeUnorderedBulkOp();
+ assert.throws(() => {
+ bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).remove();
+ });
+
+ // Test updateOne ordered bulk write operation with collation specification.
+ bulk = db.batch_write_collation_estsize.initializeOrderedBulkOp();
+ assert.throws(() => {
+ bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).updateOne({str: "BAR"});
+ });
+
+ // Test update ordered bulk write operation with collation specification.
+ bulk = db.batch_write_collation_estsize.initializeOrderedBulkOp();
+ assert.throws(() => {
+ bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).update({str: "BAR"});
+ });
+
+ // Test replaceOne ordered bulk write operation with collation specification.
+ bulk = db.batch_write_collation_estsize.initializeOrderedBulkOp();
+ assert.throws(() => {
+ bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).replaceOne({str: "BAR"});
+ });
+
+ // Test removeOne ordered bulk write operation with collation specification.
+ bulk = db.batch_write_collation_estsize.initializeOrderedBulkOp();
+ assert.throws(() => {
+ bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).removeOne();
+ });
+
+ // Test remove ordered bulk write operation with collation specification.
+ bulk = db.batch_write_collation_estsize.initializeOrderedBulkOp();
+ assert.throws(() => {
+ bulk.find({str: "FOO"}).collation({locale: "en_US", strength: 2}).remove();
+ });
+} else {
+ // Setup the bulk write response variable.
+ let res;
+
+ // Test updateOne bulk write operation with collation specification.
+ res = db.batch_write_collation_estsize.bulkWrite([{
+ updateOne: {
+ filter: {str: "FOO"},
+ update: {$set: {str: "BAR"}},
+ collation: {
+ locale: "en_US",
+ caseLevel: false,
+ caseFirst: "off",
+ strength: 3,
+ numericOrdering: false,
+ alternate: "non-ignorable",
+ maxVariable: "punct",
+ normalization: false,
+ backwards: false
}
- }]);
- assert.eq(1, res.matchedCount);
-
- // Test updateMany bulk write operation with collation specification.
- res = db.batch_write_collation_estsize.bulkWrite([{
- updateMany: {
- filter: {str: "BAR"},
- update: {$set: {str: "FOO"}},
- collation: {
- locale: "en_US",
- caseLevel: false,
- caseFirst: "off",
- strength: 3,
- numericOrdering: false,
- alternate: "non-ignorable",
- maxVariable: "punct",
- normalization: false,
- backwards: false
- }
+ }
+ }]);
+ assert.eq(1, res.matchedCount);
+
+ // Test updateMany bulk write operation with collation specification.
+ res = db.batch_write_collation_estsize.bulkWrite([{
+ updateMany: {
+ filter: {str: "BAR"},
+ update: {$set: {str: "FOO"}},
+ collation: {
+ locale: "en_US",
+ caseLevel: false,
+ caseFirst: "off",
+ strength: 3,
+ numericOrdering: false,
+ alternate: "non-ignorable",
+ maxVariable: "punct",
+ normalization: false,
+ backwards: false
}
- }]);
- assert.eq(1, res.matchedCount);
-
- // Test replaceOne bulk write operation with collation specification.
- res = db.batch_write_collation_estsize.bulkWrite([{
- replaceOne: {
- filter: {str: "FOO"},
- replacement: {str: "BAR"},
- collation: {
- locale: "en_US",
- caseLevel: false,
- caseFirst: "off",
- strength: 3,
- numericOrdering: false,
- alternate: "non-ignorable",
- maxVariable: "punct",
- normalization: false,
- backwards: false
- }
+ }
+ }]);
+ assert.eq(1, res.matchedCount);
+
+ // Test replaceOne bulk write operation with collation specification.
+ res = db.batch_write_collation_estsize.bulkWrite([{
+ replaceOne: {
+ filter: {str: "FOO"},
+ replacement: {str: "BAR"},
+ collation: {
+ locale: "en_US",
+ caseLevel: false,
+ caseFirst: "off",
+ strength: 3,
+ numericOrdering: false,
+ alternate: "non-ignorable",
+ maxVariable: "punct",
+ normalization: false,
+ backwards: false
}
- }]);
- assert.eq(1, res.matchedCount);
-
- // Test deleteMany bulk write operation with collation specification.
- res = db.batch_write_collation_estsize.bulkWrite([{
- deleteOne: {
- filter: {str: "BAR"},
- collation: {
- locale: "en_US",
- caseLevel: false,
- caseFirst: "off",
- strength: 3,
- numericOrdering: false,
- alternate: "non-ignorable",
- maxVariable: "punct",
- normalization: false,
- backwards: false
- }
+ }
+ }]);
+ assert.eq(1, res.matchedCount);
+
+ // Test deleteMany bulk write operation with collation specification.
+ res = db.batch_write_collation_estsize.bulkWrite([{
+ deleteOne: {
+ filter: {str: "BAR"},
+ collation: {
+ locale: "en_US",
+ caseLevel: false,
+ caseFirst: "off",
+ strength: 3,
+ numericOrdering: false,
+ alternate: "non-ignorable",
+ maxVariable: "punct",
+ normalization: false,
+ backwards: false
}
- }]);
- assert.eq(1, res.deletedCount);
-
- // Reinsert a document to test deleteMany bulk write operation.
- assert.writeOK(db.batch_write_collation_estsize.insert({str: "FOO"}));
-
- // Test deleteMany bulk write operation with collation specification.
- res = db.batch_write_collation_estsize.bulkWrite([{
- deleteMany: {
- filter: {str: "FOO"},
- collation: {
- locale: "en_US",
- caseLevel: false,
- caseFirst: "off",
- strength: 3,
- numericOrdering: false,
- alternate: "non-ignorable",
- maxVariable: "punct",
- normalization: false,
- backwards: false
- }
+ }
+ }]);
+ assert.eq(1, res.deletedCount);
+
+ // Reinsert a document to test deleteMany bulk write operation.
+ assert.writeOK(db.batch_write_collation_estsize.insert({str: "FOO"}));
+
+ // Test deleteMany bulk write operation with collation specification.
+ res = db.batch_write_collation_estsize.bulkWrite([{
+ deleteMany: {
+ filter: {str: "FOO"},
+ collation: {
+ locale: "en_US",
+ caseLevel: false,
+ caseFirst: "off",
+ strength: 3,
+ numericOrdering: false,
+ alternate: "non-ignorable",
+ maxVariable: "punct",
+ normalization: false,
+ backwards: false
}
- }]);
- assert.eq(1, res.deletedCount);
- }
+ }
+ }]);
+ assert.eq(1, res.deletedCount);
+}
})();