Skip to content

Commit 93dfdb6

Browse files
rsteinkeXMongoDB Bot
authored andcommitted
SERVER-100214 Remove extra trailing braces from json strings (#32261)
GitOrigin-RevId: 3be4a8a0ed8c4979bde4850d081263e3a4ed054c
1 parent 35a6056 commit 93dfdb6

File tree

56 files changed

+340
-360
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+340
-360
lines changed

src/mongo/bson/mutable/mutable_bson_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ TEST(Documentation, Example2) {
940940
static const char outJson[] =
941941
"{"
942942
" 'petunias': { 'alive': true, 'dv': 0.0, 'height': 0 },"
943-
" 'ex-whale': { 'attrs': [ 'big' ] } })"
943+
" 'ex-whale': { 'attrs': [ 'big' ] }"
944944
"}";
945945

946946
mongo::BSONObjBuilder builder;
@@ -1620,7 +1620,7 @@ TEST(Document, SetValueElementSetToOtherDocRoot) {
16201620
mongo::BSONObj inObj = mongo::fromjson("{ a : { b : 4 } }");
16211621
mmb::Document doc1(inObj);
16221622

1623-
mongo::BSONObj inObj2 = mongo::fromjson("{ c : 5 } }");
1623+
mongo::BSONObj inObj2 = mongo::fromjson("{ c : 5 }");
16241624
mmb::Document doc2(inObj2);
16251625

16261626
auto setTo = doc1.root().leftChild().leftChild();
@@ -1640,7 +1640,7 @@ TEST(Document, CreateElementWithEmptyFieldName) {
16401640
}
16411641

16421642
TEST(Document, CreateElementFromBSONElement) {
1643-
mongo::BSONObj obj = mongo::fromjson("{a:1}}");
1643+
mongo::BSONObj obj = mongo::fromjson("{a:1}");
16441644
mmb::Document doc;
16451645
ASSERT_OK(doc.root().appendElement(obj["a"]));
16461646

src/mongo/db/catalog/collection_options_test.cpp

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -575,8 +575,7 @@ TEST(FLECollectionOptions, Equality_AllowedTypes) {
575575
"queries": {"queryType": "equality"}
576576
}
577577
]
578-
}
579-
}})"))
578+
}})"))
580579
.getStatus());
581580
}
582581

@@ -627,8 +626,7 @@ TEST(FLECollectionOptions, Equality_DisAllowedTypes) {
627626
"queries": {"queryType": "equality"}
628627
}
629628
]
630-
}
631-
}})")));
629+
}})")));
632630
}
633631

634632
for (const auto& type : typesDisallowedUnindexed) {
@@ -660,8 +658,7 @@ TEST(FLECollectionOptions, Range_AllowedTypes) {
660658
"queries": {"queryType": "rangePreview", "sparsity" : 1, min : 1, max : 2}
661659
}
662660
]
663-
}
664-
}})"))
661+
}})"))
665662
.getStatus());
666663

667664
ASSERT_OK(CollectionOptions::parse(fromjson(str::stream() << R"({
@@ -674,8 +671,7 @@ TEST(FLECollectionOptions, Range_AllowedTypes) {
674671
"queries": {"queryType": "rangePreview", "sparsity" : 1, min : {$numberLong: "1"}, max : {$numberLong: "2"}}
675672
}
676673
]
677-
}
678-
}})"))
674+
}})"))
679675
.getStatus());
680676

681677
for (const auto& type : std::vector<std::string>{"double", "decimal"}) {
@@ -689,8 +685,7 @@ TEST(FLECollectionOptions, Range_AllowedTypes) {
689685
"queries": {"queryType": "rangePreview", "sparsity" : 1}
690686
}
691687
]
692-
}
693-
}})"))
688+
}})"))
694689
.getStatus());
695690
}
696691

@@ -706,8 +701,7 @@ TEST(FLECollectionOptions, Range_AllowedTypes) {
706701
"queries": {"queryType": "rangePreview", "sparsity" : 1, min: 0.000, max: 1.000, precision: 3}
707702
}
708703
]
709-
}
710-
}})"))
704+
}})"))
711705
.getStatus());
712706

713707
ASSERT_OK(CollectionOptions::parse(fromjson(str::stream() << R"({
@@ -722,8 +716,7 @@ TEST(FLECollectionOptions, Range_AllowedTypes) {
722716
"queries": {"queryType": "rangePreview", "sparsity" : 1, min: NumberDecimal("0.000"), max: NumberDecimal("1.000"), precision: 3}
723717
}
724718
]
725-
}
726-
}})"))
719+
}})"))
727720
.getStatus());
728721

729722
// Validate date works
@@ -737,8 +730,7 @@ TEST(FLECollectionOptions, Range_AllowedTypes) {
737730
"queries": {"queryType": "rangePreview", "sparsity" : 1, min : {"$date": {"$numberLong": "12344"}}, max : {"$date": {"$numberLong": "12345"}}}
738731
}
739732
]
740-
}
741-
}})"))
733+
}})"))
742734
.getStatus());
743735
}
744736

@@ -776,8 +768,7 @@ TEST(FLECollectionOptions, Range_DisAllowedTypes) {
776768
"queries": {"queryType": "rangePreview"}
777769
}
778770
]
779-
}
780-
}})")));
771+
}})")));
781772
}
782773
}
783774

@@ -795,7 +786,6 @@ TEST(FLECollectionOptions, Range_MissingFields) {
795786
"queries": {"queryType": "rangePreview"}
796787
}
797788
]
798-
}
799789
}})")));
800790

801791
ASSERT_STATUS_CODE(6775203, CollectionOptions::parse(fromjson(R"({
@@ -808,7 +798,6 @@ TEST(FLECollectionOptions, Range_MissingFields) {
808798
"queries": {"queryType": "rangePreview", sparsity: 1}
809799
}
810800
]
811-
}
812801
}})")));
813802

814803
ASSERT_STATUS_CODE(6775204, CollectionOptions::parse(fromjson(R"({
@@ -821,7 +810,6 @@ TEST(FLECollectionOptions, Range_MissingFields) {
821810
"queries": {"queryType": "rangePreview", sparsity: 1, min : 1}
822811
}
823812
]
824-
}
825813
}})")));
826814
}
827815

@@ -839,8 +827,7 @@ TEST(FLECollectionOptions, Equality_ExtraFields) {
839827
"queries": {"queryType": "equality", sparsity:1}
840828
}
841829
]
842-
}
843-
}})")));
830+
}})")));
844831

845832
ASSERT_STATUS_CODE(6775206, CollectionOptions::parse(fromjson(R"({
846833
encryptedFields: {
@@ -852,8 +839,7 @@ TEST(FLECollectionOptions, Equality_ExtraFields) {
852839
"queries": {"queryType": "equality", min:1}
853840
}
854841
]
855-
}
856-
}})")));
842+
}})")));
857843

858844
ASSERT_STATUS_CODE(6775207, CollectionOptions::parse(fromjson(R"({
859845
encryptedFields: {
@@ -865,8 +851,7 @@ TEST(FLECollectionOptions, Equality_ExtraFields) {
865851
"queries": {"queryType": "equality", max:1}
866852
}
867853
]
868-
}
869-
}})")));
854+
}})")));
870855
}
871856

872857

@@ -1014,8 +999,7 @@ TEST(FLECollectionOptions, Range_BoundTypeMismatch) {
1014999
"queries": {"queryType": "rangePreview", "sparsity" : 1, min: {"$numberLong": "12344"}, max: {"$numberLong": "123440"}}
10151000
}
10161001
]
1017-
}
1018-
}})")));
1002+
}})")));
10191003

10201004
ASSERT_STATUS_CODE(7018200, CollectionOptions::parse(fromjson(str::stream() << R"({
10211005
encryptedFields: {
@@ -1027,8 +1011,7 @@ TEST(FLECollectionOptions, Range_BoundTypeMismatch) {
10271011
"queries": {"queryType": "rangePreview", "sparsity" : 1, min: 1, max: 2}
10281012
}
10291013
]
1030-
}
1031-
}})")));
1014+
}})")));
10321015

10331016
ASSERT_STATUS_CODE(7018201, CollectionOptions::parse(fromjson(str::stream() << R"({
10341017
encryptedFields: {
@@ -1040,8 +1023,7 @@ TEST(FLECollectionOptions, Range_BoundTypeMismatch) {
10401023
"queries": {"queryType": "rangePreview", "sparsity" : 1, min: {$numberLong: "1"}, max: 2}
10411024
}
10421025
]
1043-
}
1044-
}})")));
1026+
}})")));
10451027
ASSERT_STATUS_CODE(7018201, CollectionOptions::parse(fromjson(str::stream() << R"({
10461028
encryptedFields: {
10471029
"fields": [
@@ -1052,8 +1034,7 @@ TEST(FLECollectionOptions, Range_BoundTypeMismatch) {
10521034
"queries": {"queryType": "rangePreview", "sparsity" : 1, min: 1, max: {"$numberLong": "123440"}}
10531035
}
10541036
]
1055-
}
1056-
}})")));
1037+
}})")));
10571038
}
10581039

10591040
} // namespace mongo

src/mongo/db/cst/cst_match_translation_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,21 +276,21 @@ TEST(CstMatchTranslationTest, TranslatesType) {
276276

277277
TEST(CstMatchTranslationTest, TranslatesComment) {
278278
{
279-
auto input = fromjson("{filter: {a: 1, $comment: \"hello, world\"}}}");
279+
auto input = fromjson("{filter: {a: 1, $comment: \"hello, world\"}}");
280280
auto cst = parseMatchToCst(input);
281281
auto match = translate(cst);
282282
ASSERT_EQ(match->serialize().toString(), "{ $and: [ { a: { $eq: 1 } } ] }");
283283
}
284284
{
285-
auto input = fromjson("{filter: {$comment: \"hello, world\"}}}");
285+
auto input = fromjson("{filter: {$comment: \"hello, world\"}}");
286286
auto cst = parseMatchToCst(input);
287287
auto match = translate(cst);
288288
auto andExpr = dynamic_cast<AndMatchExpression*>(match.get());
289289
ASSERT(andExpr);
290290
ASSERT_EQ(0, andExpr->numChildren());
291291
}
292292
{
293-
auto input = fromjson("{filter: {a: {$exists: true}, $comment: \"hello, world\"}}}");
293+
auto input = fromjson("{filter: {a: {$exists: true}, $comment: \"hello, world\"}}");
294294
auto cst = parseMatchToCst(input);
295295
auto match = translate(cst);
296296
ASSERT_EQ(match->serialize().toString(), "{ $and: [ { a: { $exists: true } } ] }");

src/mongo/db/exec/exclusion_projection_executor_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ TEST(ExclusionProjectionExecutionTest, ShouldExtractPartOfProjectOnRootField) {
588588

589589
TEST(ExclusionProjectionExecutionTest, ShouldExtractPartOfProjectOnSubfields) {
590590
auto exclusion =
591-
makeExclusionProjectionWithDefaultPolicies(fromjson("{'x.y': 0, 'x.z': 0, 'c.d': 0}}"));
591+
makeExclusionProjectionWithDefaultPolicies(fromjson("{'x.y': 0, 'x.z': 0, 'c.d': 0}"));
592592

593593
auto [extractedProj, allExtracted] = exclusion->extractProjectOnFieldAndRename("x", "w");
594594

src/mongo/db/fts/fts_spec_test.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ TEST(FTSSpec, FixLanguageOverride1) {
164164
}
165165

166166
TEST(FTSSpec, FixTextIndexVersion1) {
167-
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: 1.0}}");
168-
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberInt(1)}}");
169-
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberLong(1)}}");
170-
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: 2.0}}");
171-
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberInt(2)}}");
172-
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberLong(2)}}");
167+
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: 1.0}");
168+
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberInt(1)}");
169+
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberLong(1)}");
170+
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: 2.0}");
171+
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberInt(2)}");
172+
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberLong(2)}");
173173
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: 3.0}");
174-
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberInt(3)}}");
175-
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberLong(3)}}");
174+
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberInt(3)}");
175+
assertFixSuccess("{key: {a: 'text'}, textIndexVersion: NumberLong(3)}");
176176

177177
assertFixFailure("{key: {a: 'text'}, textIndexVersion: 4}");
178178
assertFixFailure("{key: {a: 'text'}, textIndexVersion: '2'}");

src/mongo/db/index/btree_key_generator_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ TEST(BtreeKeyGeneratorTest, GetKeysFromSecondLevelArray) {
287287

288288
TEST(BtreeKeyGeneratorTest, GetKeysFromParallelArraysBasic) {
289289
BSONObj keyPattern = fromjson("{'a': 1, 'b': 1}");
290-
BSONObj genKeysFrom = fromjson("{a: [1, 2, 3], b: [1, 2, 3]}}");
290+
BSONObj genKeysFrom = fromjson("{a: [1, 2, 3], b: [1, 2, 3]}");
291291
KeyStringSet expectedKeys;
292292
MultikeyPaths expectedMultikeyPaths(keyPattern.nFields());
293293
ASSERT_THROWS(testKeygen(keyPattern,

src/mongo/db/index/sort_key_generator_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ TEST_F(SortKeyGeneratorWorkingSetTest, CanGetSortKeyFromWorkingSetMemberWithOwne
313313
}
314314

315315
TEST_F(SortKeyGeneratorWorkingSetTest, CanGenerateKeyFromWSMForTextScoreMetaSort) {
316-
BSONObj pattern = fromjson("{a: 1, b: {$meta: 'textScore'}, c: -1}}");
316+
BSONObj pattern = fromjson("{a: 1, b: {$meta: 'textScore'}, c: -1}");
317317
auto sortKeyGen = makeSortKeyGen(pattern, nullptr);
318318
setOwnedObj(BSON("x" << 1 << "a" << 2 << "y" << 3 << "c" << BSON_ARRAY(4 << 5 << 6)));
319319
member().metadata().setTextScore(9.9);

src/mongo/db/index/wildcard_key_generator_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,7 @@ TEST_F(WildcardKeyGeneratorDottedFieldsTest, DoNotIndexDottedFields) {
12291229

12301230
auto inputDoc = fromjson(
12311231
"{'a.b': 0, '.b': 1, 'b.': 2, a: {'.b': 3, 'b.': 4, 'b.c': 5, 'q': 6}, b: [{'d.e': 7}, {r: "
1232-
"8}, [{'a.b': 9}]], c: 10}}");
1232+
"8}, [{'a.b': 9}]], c: 10}");
12331233

12341234
auto expectedKeys = makeKeySet({fromjson("{'': 'a.q', '': 6}"),
12351235
fromjson("{'': 'b.r', '': 8}"),

0 commit comments

Comments
 (0)