diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-07-29 21:00:16 -0400 |
---|---|---|
committer | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2019-07-29 21:06:47 -0400 |
commit | 0d6d248c39a5b4e43eefc9320b5dec3229cfcfdb (patch) | |
tree | 1fb67633d3c9c551341dbf41efb47a80c6392553 /src/mongo/dbtests | |
parent | 47d0308cd596c6d40d6a3069379be1bdaf51d47b (diff) | |
download | mongo-0d6d248c39a5b4e43eefc9320b5dec3229cfcfdb.tar.gz |
SERVER-41696 Remove the 'ns' field from index specs
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r-- | src/mongo/dbtests/counttests.cpp | 2 | ||||
-rw-r--r-- | src/mongo/dbtests/dbtests.cpp | 1 | ||||
-rw-r--r-- | src/mongo/dbtests/indexcatalogtests.cpp | 10 | ||||
-rw-r--r-- | src/mongo/dbtests/indexupdatetests.cpp | 60 | ||||
-rw-r--r-- | src/mongo/dbtests/multikey_paths_test.cpp | 21 | ||||
-rw-r--r-- | src/mongo/dbtests/query_stage_count.cpp | 2 | ||||
-rw-r--r-- | src/mongo/dbtests/query_stage_ixscan.cpp | 5 | ||||
-rw-r--r-- | src/mongo/dbtests/querytests.cpp | 1 | ||||
-rw-r--r-- | src/mongo/dbtests/rollbacktests.cpp | 24 | ||||
-rw-r--r-- | src/mongo/dbtests/storage_timestamp_tests.cpp | 37 | ||||
-rw-r--r-- | src/mongo/dbtests/validate_tests.cpp | 81 | ||||
-rw-r--r-- | src/mongo/dbtests/wildcard_multikey_persistence_test.cpp | 3 |
12 files changed, 114 insertions, 133 deletions
diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp index 9f820418793..41ad97c5203 100644 --- a/src/mongo/dbtests/counttests.cpp +++ b/src/mongo/dbtests/counttests.cpp @@ -59,7 +59,7 @@ public: IndexCatalog* indexCatalog = _collection->getIndexCatalog(); auto indexSpec = BSON("v" << static_cast<int>(IndexDescriptor::kLatestIndexVersion) - << "ns" << ns() << "key" << BSON("a" << 1) << "name" + << "key" << BSON("a" << 1) << "name" << "a_1"); uassertStatusOK(indexCatalog->createIndexOnEmptyCollection(&_opCtx, indexSpec)); diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp index c61f4d390b2..6f33b22ebe8 100644 --- a/src/mongo/dbtests/dbtests.cpp +++ b/src/mongo/dbtests/dbtests.cpp @@ -86,7 +86,6 @@ void initWireSpec() { Status createIndex(OperationContext* opCtx, StringData ns, const BSONObj& keys, bool unique) { BSONObjBuilder specBuilder; specBuilder.append("name", DBClientBase::genIndexName(keys)); - specBuilder.append("ns", ns); specBuilder.append("key", keys); specBuilder.append("v", static_cast<int>(kIndexVersion)); if (unique) { diff --git a/src/mongo/dbtests/indexcatalogtests.cpp b/src/mongo/dbtests/indexcatalogtests.cpp index 9ac94209601..802a200ead9 100644 --- a/src/mongo/dbtests/indexcatalogtests.cpp +++ b/src/mongo/dbtests/indexcatalogtests.cpp @@ -143,11 +143,11 @@ public: dbtests::WriteContextForTests ctx(&opCtx, _nss.ns()); const std::string indexName = "x_1"; - ASSERT_OK(dbtests::createIndexFromSpec( - &opCtx, - _nss.ns(), - BSON("name" << indexName << "ns" << _nss.ns() << "key" << BSON("x" << 1) << "v" - << static_cast<int>(kIndexVersion) << "expireAfterSeconds" << 5))); + ASSERT_OK(dbtests::createIndexFromSpec(&opCtx, + _nss.ns(), + BSON("name" << indexName << "key" << BSON("x" << 1) + << "v" << static_cast<int>(kIndexVersion) + << "expireAfterSeconds" << 5))); const IndexDescriptor* desc = _catalog->findIndexByName(&opCtx, indexName); ASSERT(desc); diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp index 63ed34e3871..362b34ae44a 100644 --- a/src/mongo/dbtests/indexupdatetests.cpp +++ b/src/mongo/dbtests/indexupdatetests.cpp @@ -134,7 +134,7 @@ public: const BSONObj spec = BSON("name" << "a" - << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "v" + << "key" << BSON("a" << 1) << "v" << static_cast<int>(kIndexVersion) << "unique" << true << "background" << background); @@ -182,7 +182,7 @@ public: const BSONObj spec = BSON("name" << "a" - << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "v" + << "key" << BSON("a" << 1) << "v" << static_cast<int>(kIndexVersion) << "unique" << true << "background" << background); @@ -226,7 +226,7 @@ public: } // Request an interrupt. getGlobalServiceContext()->setKillAllOperations(); - BSONObj indexInfo = BSON("key" << BSON("a" << 1) << "ns" << _ns << "name" + BSONObj indexInfo = BSON("key" << BSON("a" << 1) << "name" << "a_1" << "v" << static_cast<int>(kIndexVersion)); // The call is interrupted because mayInterrupt == true. @@ -269,7 +269,7 @@ public: } // Request an interrupt. getGlobalServiceContext()->setKillAllOperations(); - BSONObj indexInfo = BSON("key" << BSON("_id" << 1) << "ns" << _ns << "name" + BSONObj indexInfo = BSON("key" << BSON("_id" << 1) << "name" << "_id_" << "v" << static_cast<int>(kIndexVersion)); ASSERT_TRUE(buildIndexInterrupted(indexInfo)); @@ -317,7 +317,7 @@ public: ASSERT_OK(createIndex("unittest", BSON("name" << "x" - << "ns" << _ns << "key" << BSON("x" << 1 << "y" << 1) << "v" + << "key" << BSON("x" << 1 << "y" << 1) << "v" << static_cast<int>(kIndexVersion)))); } }; @@ -330,9 +330,8 @@ public: createIndex("unittest", BSON("name" << "x" - << "ns" << _ns << "unique" << true << "key" - << BSON("x" << 1 << "y" << 1) << "v" - << static_cast<int>(kIndexVersion)))); + << "unique" << true << "key" << BSON("x" << 1 << "y" << 1) + << "v" << static_cast<int>(kIndexVersion)))); } }; @@ -342,7 +341,7 @@ public: ASSERT_OK(createIndex("unittest", BSON("name" << "x" - << "ns" << _ns << "key" << BSON("x" << 1 << "y" << 1) << "v" + << "key" << BSON("x" << 1 << "y" << 1) << "v" << static_cast<int>(kIndexVersion)))); } }; @@ -355,7 +354,7 @@ public: createIndex("unittest", BSON("name" << "x" - << "ns" << _ns << "key" << BSON("y" << 1 << "x" << 1) << "v" + << "key" << BSON("y" << 1 << "x" << 1) << "v" << static_cast<int>(kIndexVersion)))); } }; @@ -369,8 +368,8 @@ public: ASSERT_OK(createIndex("unittests", BSON("name" << "super" - << "ns" << _ns << "unique" << 1 << "sparse" << true - << "expireAfterSeconds" << 3600 << "key" + << "unique" << 1 << "sparse" << true << "expireAfterSeconds" + << 3600 << "key" << BSON("superIdx" << "2d") << "v" << static_cast<int>(kIndexVersion)))); @@ -387,8 +386,8 @@ public: createIndex("unittests", BSON("name" << "super2" - << "ns" << _ns << "expireAfterSeconds" << 3600 << "sparse" - << true << "unique" << 1 << "key" + << "expireAfterSeconds" << 3600 << "sparse" << true + << "unique" << 1 << "key" << BSON("superIdx" << "2d") << "v" << static_cast<int>(kIndexVersion)))); @@ -403,8 +402,8 @@ public: ASSERT_OK(createIndex("unittests", BSON("name" << "super" - << "ns" << _ns << "expireAfterSeconds" << 3600 << "sparse" - << true << "unique" << 1 << "key" + << "expireAfterSeconds" << 3600 << "sparse" << true << "unique" + << 1 << "key" << BSON("superIdx" << "2d") << "v" << static_cast<int>(kIndexVersion)))); @@ -421,7 +420,7 @@ public: createIndex("unittest", BSON("name" << "super2" - << "ns" << _ns << "unique" << false << "sparse" << true + << "unique" << false << "sparse" << true << "expireAfterSeconds" << 3600 << "key" << BSON("superIdx" << "2d") @@ -432,16 +431,15 @@ public: class SameSpecDifferentSparse : public ComplexIndex { public: void run() { - ASSERT_EQUALS( - ErrorCodes::IndexOptionsConflict, - createIndex("unittest", - BSON("name" - << "super2" - << "ns" << _ns << "unique" << 1 << "sparse" << false << "background" - << true << "expireAfterSeconds" << 3600 << "key" - << BSON("superIdx" - << "2d") - << "v" << static_cast<int>(kIndexVersion)))); + ASSERT_EQUALS(ErrorCodes::IndexOptionsConflict, + createIndex("unittest", + BSON("name" + << "super2" + << "unique" << 1 << "sparse" << false << "background" << true + << "expireAfterSeconds" << 3600 << "key" + << BSON("superIdx" + << "2d") + << "v" << static_cast<int>(kIndexVersion)))); } }; @@ -452,8 +450,8 @@ public: createIndex("unittest", BSON("name" << "super2" - << "ns" << _ns << "unique" << 1 << "sparse" << true - << "expireAfterSeconds" << 2400 << "key" + << "unique" << 1 << "sparse" << true << "expireAfterSeconds" + << 2400 << "key" << BSON("superIdx" << "2d") << "v" << static_cast<int>(kIndexVersion)))); @@ -503,8 +501,8 @@ protected: BSONObj _createSpec(T storageEngineValue) { return BSON("name" << "super2" - << "ns" << _ns << "key" << BSON("a" << 1) << "v" - << static_cast<int>(kIndexVersion) << "storageEngine" << storageEngineValue); + << "key" << BSON("a" << 1) << "v" << static_cast<int>(kIndexVersion) + << "storageEngine" << storageEngineValue); } }; diff --git a/src/mongo/dbtests/multikey_paths_test.cpp b/src/mongo/dbtests/multikey_paths_test.cpp index 8f0759f69b1..6c72c3e8936 100644 --- a/src/mongo/dbtests/multikey_paths_test.cpp +++ b/src/mongo/dbtests/multikey_paths_test.cpp @@ -142,8 +142,7 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreation) { createIndex(collection, BSON("name" << "a_1_b_1" - << "ns" << _nss.ns() << "key" << keyPattern << "v" - << static_cast<int>(kIndexVersion))) + << "key" << keyPattern << "v" << static_cast<int>(kIndexVersion))) .transitional_ignore(); assertMultikeyPaths(collection, keyPattern, {std::set<size_t>{}, {0U}}); @@ -172,8 +171,7 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreationWithMultipleDocuments) { createIndex(collection, BSON("name" << "a_1_b_1" - << "ns" << _nss.ns() << "key" << keyPattern << "v" - << static_cast<int>(kIndexVersion))) + << "key" << keyPattern << "v" << static_cast<int>(kIndexVersion))) .transitional_ignore(); assertMultikeyPaths(collection, keyPattern, {{0U}, {0U}}); @@ -188,8 +186,7 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentInsert) { createIndex(collection, BSON("name" << "a_1_b_1" - << "ns" << _nss.ns() << "key" << keyPattern << "v" - << static_cast<int>(kIndexVersion))) + << "key" << keyPattern << "v" << static_cast<int>(kIndexVersion))) .transitional_ignore(); { @@ -226,8 +223,7 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentUpdate) { createIndex(collection, BSON("name" << "a_1_b_1" - << "ns" << _nss.ns() << "key" << keyPattern << "v" - << static_cast<int>(kIndexVersion))) + << "key" << keyPattern << "v" << static_cast<int>(kIndexVersion))) .transitional_ignore(); { @@ -275,8 +271,7 @@ TEST_F(MultikeyPathsTest, PathsNotUpdatedOnDocumentDelete) { createIndex(collection, BSON("name" << "a_1_b_1" - << "ns" << _nss.ns() << "key" << keyPattern << "v" - << static_cast<int>(kIndexVersion))) + << "key" << keyPattern << "v" << static_cast<int>(kIndexVersion))) .transitional_ignore(); { @@ -316,16 +311,14 @@ TEST_F(MultikeyPathsTest, PathsUpdatedForMultipleIndexesOnDocumentInsert) { createIndex(collection, BSON("name" << "a_1_b_1" - << "ns" << _nss.ns() << "key" << keyPatternAB << "v" - << static_cast<int>(kIndexVersion))) + << "key" << keyPatternAB << "v" << static_cast<int>(kIndexVersion))) .transitional_ignore(); BSONObj keyPatternAC = BSON("a" << 1 << "c" << 1); createIndex(collection, BSON("name" << "a_1_c_1" - << "ns" << _nss.ns() << "key" << keyPatternAC << "v" - << static_cast<int>(kIndexVersion))) + << "key" << keyPatternAC << "v" << static_cast<int>(kIndexVersion))) .transitional_ignore(); { WriteUnitOfWork wuow(_opCtx.get()); diff --git a/src/mongo/dbtests/query_stage_count.cpp b/src/mongo/dbtests/query_stage_count.cpp index 87e66a58918..6444ee4b9ea 100644 --- a/src/mongo/dbtests/query_stage_count.cpp +++ b/src/mongo/dbtests/query_stage_count.cpp @@ -75,7 +75,7 @@ public: ->createIndexOnEmptyCollection(&_opCtx, BSON("key" << BSON("x" << 1) << "name" << "x_1" - << "ns" << ns() << "v" << 1)) + << "v" << 1)) .status_with_transitional_ignore(); for (int i = 0; i < kDocuments; i++) { diff --git a/src/mongo/dbtests/query_stage_ixscan.cpp b/src/mongo/dbtests/query_stage_ixscan.cpp index 3217ebd979b..ca36a6710d7 100644 --- a/src/mongo/dbtests/query_stage_ixscan.cpp +++ b/src/mongo/dbtests/query_stage_ixscan.cpp @@ -61,9 +61,8 @@ public: ASSERT_OK(_coll->getIndexCatalog()->createIndexOnEmptyCollection( &_opCtx, - BSON("ns" << ns() << "key" << BSON("x" << 1) << "name" - << DBClientBase::genIndexName(BSON("x" << 1)) << "v" - << static_cast<int>(kIndexVersion)))); + BSON("key" << BSON("x" << 1) << "name" << DBClientBase::genIndexName(BSON("x" << 1)) + << "v" << static_cast<int>(kIndexVersion)))); wunit.commit(); } diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp index 6e74f6c1571..c91ab589923 100644 --- a/src/mongo/dbtests/querytests.cpp +++ b/src/mongo/dbtests/querytests.cpp @@ -100,7 +100,6 @@ protected: void addIndex(const IndexSpec& spec) { BSONObjBuilder builder(spec.toBSON()); builder.append("v", int(IndexDescriptor::kLatestIndexVersion)); - builder.append("ns", ns()); auto specObj = builder.obj(); MultiIndexBlock indexer; diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp index 317be739e89..fd48e6f46a3 100644 --- a/src/mongo/dbtests/rollbacktests.cpp +++ b/src/mongo/dbtests/rollbacktests.cpp @@ -541,8 +541,8 @@ public: IndexCatalog* catalog = coll->getIndexCatalog(); string idxName = "a"; - BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName << "v" - << static_cast<int>(kIndexVersion)); + BSONObj spec = BSON("key" << BSON("a" << 1) << "name" << idxName << "v" + << static_cast<int>(kIndexVersion)); // END SETUP / START TEST @@ -582,8 +582,8 @@ public: IndexCatalog* catalog = coll->getIndexCatalog(); string idxName = "a"; - BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName << "v" - << static_cast<int>(kIndexVersion)); + BSONObj spec = BSON("key" << BSON("a" << 1) << "name" << idxName << "v" + << static_cast<int>(kIndexVersion)); { WriteUnitOfWork uow(&opCtx); @@ -635,8 +635,8 @@ public: IndexCatalog* catalog = coll->getIndexCatalog(); string idxName = "a"; - BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName << "v" - << static_cast<int>(kIndexVersion)); + BSONObj spec = BSON("key" << BSON("a" << 1) << "name" << idxName << "v" + << static_cast<int>(kIndexVersion)); // END SETUP / START TEST @@ -678,12 +678,12 @@ public: string idxNameA = "indexA"; string idxNameB = "indexB"; string idxNameC = "indexC"; - BSONObj specA = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxNameA << "v" - << static_cast<int>(kIndexVersion)); - BSONObj specB = BSON("ns" << ns << "key" << BSON("b" << 1) << "name" << idxNameB << "v" - << static_cast<int>(kIndexVersion)); - BSONObj specC = BSON("ns" << ns << "key" << BSON("c" << 1) << "name" << idxNameC << "v" - << static_cast<int>(kIndexVersion)); + BSONObj specA = BSON("key" << BSON("a" << 1) << "name" << idxNameA << "v" + << static_cast<int>(kIndexVersion)); + BSONObj specB = BSON("key" << BSON("b" << 1) << "name" << idxNameB << "v" + << static_cast<int>(kIndexVersion)); + BSONObj specC = BSON("key" << BSON("c" << 1) << "name" << idxNameC << "v" + << static_cast<int>(kIndexVersion)); // END SETUP / START TEST diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp index 60d10e576f3..6e79c1b8ae3 100644 --- a/src/mongo/dbtests/storage_timestamp_tests.cpp +++ b/src/mongo/dbtests/storage_timestamp_tests.cpp @@ -261,8 +261,7 @@ public: auto swIndexInfoObj = indexer.init(_opCtx, coll, - {BSON("v" << 2 << "name" << indexName << "ns" << coll->ns().ns() - << "key" << indexKey)}, + {BSON("v" << 2 << "name" << indexName << "key" << indexKey)}, MultiIndexBlock::makeTimestampedIndexOnInitFn(_opCtx, coll)); ASSERT_OK(swIndexInfoObj.getStatus()); indexInfoObj = std::move(swIndexInfoObj.getValue()[0]); @@ -1260,8 +1259,8 @@ public: uuid = autoColl.getCollection()->uuid(); } auto indexName = "a_1"; - auto indexSpec = BSON("name" << indexName << "ns" << nss.ns() << "key" << BSON("a" << 1) - << "v" << static_cast<int>(kIndexVersion)); + auto indexSpec = BSON("name" << indexName << "key" << BSON("a" << 1) << "v" + << static_cast<int>(kIndexVersion)); ASSERT_OK(dbtests::createIndexFromSpec(_opCtx, nss.ns(), indexSpec)); _coordinatorMock->alwaysAllowWrites(false); @@ -1329,8 +1328,8 @@ public: uuid = autoColl.getCollection()->uuid(); } auto indexName = "a_1"; - auto indexSpec = BSON("name" << indexName << "ns" << nss.ns() << "key" << BSON("a" << 1) - << "v" << static_cast<int>(kIndexVersion)); + auto indexSpec = BSON("name" << indexName << "key" << BSON("a" << 1) << "v" + << static_cast<int>(kIndexVersion)); ASSERT_OK(dbtests::createIndexFromSpec(_opCtx, nss.ns(), indexSpec)); _coordinatorMock->alwaysAllowWrites(false); @@ -1357,10 +1356,10 @@ public: << "op" << "i" << "ns" << nss.ns() << "ui" << uuid << "o" << doc2)); - auto indexSpec2 = BSON("createIndexes" << nss.coll() << "ns" << nss.ns() << "v" - << static_cast<int>(kIndexVersion) << "key" - << BSON("b" << 1) << "name" - << "b_1"); + auto indexSpec2 = + BSON("createIndexes" << nss.coll() << "v" << static_cast<int>(kIndexVersion) << "key" + << BSON("b" << 1) << "name" + << "b_1"); auto createIndexOp = repl::OplogEntry( BSON("ts" << indexBuildTime.asTimestamp() << "t" << 1LL << "v" << 2 << "op" << "c" @@ -1425,8 +1424,8 @@ public: AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX); auto indexName = "a_1"; - auto indexSpec = BSON("name" << indexName << "ns" << nss.ns() << "key" << BSON("a" << 1) - << "v" << static_cast<int>(kIndexVersion)); + auto indexSpec = BSON("name" << indexName << "key" << BSON("a" << 1) << "v" + << static_cast<int>(kIndexVersion)); ASSERT_OK(dbtests::createIndexFromSpec(_opCtx, nss.ns(), indexSpec)); const LogicalTime pastTime = _clock->reserveTicks(1); @@ -1454,8 +1453,8 @@ public: AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX); auto indexName = "a_1"; - auto indexSpec = BSON("name" << indexName << "ns" << nss.ns() << "key" << BSON("a" << 1) - << "v" << static_cast<int>(kIndexVersion)); + auto indexSpec = BSON("name" << indexName << "key" << BSON("a" << 1) << "v" + << static_cast<int>(kIndexVersion)); ASSERT_OK(dbtests::createIndexFromSpec(_opCtx, nss.ns(), indexSpec)); const LogicalTime pastTime = _clock->reserveTicks(1); @@ -1877,7 +1876,7 @@ public: autoColl.getCollection(), {BSON("v" << 2 << "unique" << true << "name" << "a_1" - << "ns" << nss.ns() << "key" << BSON("a" << 1))}, + << "key" << BSON("a" << 1))}, MultiIndexBlock::makeTimestampedIndexOnInitFn(_opCtx, autoColl.getCollection())); ASSERT_OK(swIndexInfoObj.getStatus()); indexInfoObj = std::move(swIndexInfoObj.getValue()[0]); @@ -2515,10 +2514,10 @@ public: origIdents = durableCatalog->getAllIdents(_opCtx); } - auto indexSpec = BSON("createIndexes" << nss.coll() << "ns" << nss.ns() << "v" - << static_cast<int>(kIndexVersion) << "key" - << BSON("field" << 1) << "name" - << "field_1"); + auto indexSpec = + BSON("createIndexes" << nss.coll() << "v" << static_cast<int>(kIndexVersion) + << "key" << BSON("field" << 1) << "name" + << "field_1"); auto createIndexOp = BSON("ts" << startBuildTs << "t" << 1LL << "v" << 2 << "op" << "c" diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp index 39f48384421..ed805c905f7 100644 --- a/src/mongo/dbtests/validate_tests.cpp +++ b/src/mongo/dbtests/validate_tests.cpp @@ -229,14 +229,13 @@ public: wunit.commit(); } - auto status = - dbtests::createIndexFromSpec(&_opCtx, - coll->ns().ns(), - BSON("name" - << "a" - << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) - << "v" << static_cast<int>(kIndexVersion) - << "background" << false)); + auto status = dbtests::createIndexFromSpec(&_opCtx, + coll->ns().ns(), + BSON("name" + << "a" + << "key" << BSON("a" << 1) << "v" + << static_cast<int>(kIndexVersion) + << "background" << false)); ASSERT_OK(status); ASSERT_TRUE(checkValid()); @@ -301,14 +300,13 @@ public: wunit.commit(); } - auto status = - dbtests::createIndexFromSpec(&_opCtx, - coll->ns().ns(), - BSON("name" - << "a" - << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) - << "v" << static_cast<int>(kIndexVersion) - << "background" << false)); + auto status = dbtests::createIndexFromSpec(&_opCtx, + coll->ns().ns(), + BSON("name" + << "a" + << "key" << BSON("a" << 1) << "v" + << static_cast<int>(kIndexVersion) + << "background" << false)); ASSERT_OK(status); ASSERT_TRUE(checkValid()); @@ -459,8 +457,7 @@ public: coll->ns().ns(), BSON("name" << "multikey_index" - << "ns" << coll->ns().ns() << "key" - << BSON("a.b" << 1) << "v" + << "key" << BSON("a.b" << 1) << "v" << static_cast<int>(kIndexVersion) << "background" << false)); @@ -534,9 +531,9 @@ public: coll->ns().ns(), BSON("name" << "sparse_index" - << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) - << "v" << static_cast<int>(kIndexVersion) - << "background" << false << "sparse" << true)); + << "key" << BSON("a" << 1) << "v" + << static_cast<int>(kIndexVersion) << "background" + << false << "sparse" << true)); ASSERT_OK(status); ASSERT_TRUE(checkValid()); @@ -601,9 +598,9 @@ public: coll->ns().ns(), BSON("name" << "partial_index" - << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) - << "v" << static_cast<int>(kIndexVersion) - << "background" << false << "partialFilterExpression" + << "key" << BSON("a" << 1) << "v" + << static_cast<int>(kIndexVersion) << "background" + << false << "partialFilterExpression" << BSON("a" << BSON("$gt" << 1)))); ASSERT_OK(status); @@ -662,7 +659,7 @@ public: coll->ns().ns(), BSON("name" << "partial_index" - << "ns" << coll->ns().ns() << "key" + << "key" << BSON("x" << "2dsphere") << "v" << static_cast<int>(kIndexVersion) @@ -675,7 +672,7 @@ public: coll->ns().ns(), BSON("name" << "partial_index" - << "ns" << coll->ns().ns() << "key" + << "key" << BSON("x" << "2dsphere") << "v" << static_cast<int>(kIndexVersion) @@ -735,9 +732,8 @@ public: coll->ns().ns(), BSON("name" << "compound_index_1" - << "ns" << coll->ns().ns() << "key" - << BSON("a" << 1 << "b" << -1) << "v" - << static_cast<int>(kIndexVersion) + << "key" << BSON("a" << 1 << "b" << -1) + << "v" << static_cast<int>(kIndexVersion) << "background" << false)); ASSERT_OK(status); @@ -745,8 +741,7 @@ public: coll->ns().ns(), BSON("name" << "compound_index_2" - << "ns" << coll->ns().ns() << "key" - << BSON("a" << -1 << "b" << 1) << "v" + << "key" << BSON("a" << -1 << "b" << 1) << "v" << static_cast<int>(kIndexVersion) << "background" << false)); @@ -806,7 +801,7 @@ public: auto status = dbtests::createIndexFromSpec( &_opCtx, coll->ns().ns(), - BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "v" + BSON("name" << indexName << "key" << BSON("a" << 1) << "v" << static_cast<int>(kIndexVersion) << "background" << false)); ASSERT_OK(status); @@ -888,7 +883,7 @@ public: auto status = dbtests::createIndexFromSpec( &_opCtx, coll->ns().ns(), - BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "v" + BSON("name" << indexName << "key" << BSON("a" << 1) << "v" << static_cast<int>(kIndexVersion) << "background" << false)); ASSERT_OK(status); @@ -935,8 +930,8 @@ public: auto status = dbtests::createIndexFromSpec( &_opCtx, coll->ns().ns(), - BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << indexKey << "v" - << static_cast<int>(kIndexVersion) << "background" << false)); + BSON("name" << indexName << "key" << indexKey << "v" << static_cast<int>(kIndexVersion) + << "background" << false)); ASSERT_OK(status); // Insert non-multikey documents. @@ -1044,8 +1039,8 @@ public: auto status = dbtests::createIndexFromSpec( &_opCtx, coll->ns().ns(), - BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << indexKey << "v" - << static_cast<int>(kIndexVersion) << "background" << false)); + BSON("name" << indexName << "key" << indexKey << "v" << static_cast<int>(kIndexVersion) + << "background" << false)); ASSERT_OK(status); // Insert documents with indexed and not-indexed paths. @@ -1135,8 +1130,8 @@ public: auto status = dbtests::createIndexFromSpec( &_opCtx, coll->ns().ns(), - BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << indexKey << "v" - << static_cast<int>(kIndexVersion) << "background" << false)); + BSON("name" << indexName << "key" << indexKey << "v" << static_cast<int>(kIndexVersion) + << "background" << false)); ASSERT_OK(status); // Insert documents. @@ -1222,8 +1217,8 @@ public: auto status = dbtests::createIndexFromSpec( &_opCtx, coll->ns().ns(), - BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << indexKey << "v" - << static_cast<int>(kIndexVersion) << "background" << false)); + BSON("name" << indexName << "key" << indexKey << "v" << static_cast<int>(kIndexVersion) + << "background" << false)); ASSERT_OK(status); // Insert documents. @@ -1328,8 +1323,8 @@ public: auto status = dbtests::createIndexFromSpec( &_opCtx, coll->ns().ns(), - BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << indexKey << "v" - << static_cast<int>(kIndexVersion) << "background" << false)); + BSON("name" << indexName << "key" << indexKey << "v" << static_cast<int>(kIndexVersion) + << "background" << false)); ASSERT_OK(status); // Insert documents. diff --git a/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp b/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp index 8ace89874da..6731153ed88 100644 --- a/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp +++ b/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp @@ -181,8 +181,7 @@ protected: BSONObj key, BSONObj pathProjection, bool background) { - BSONObjBuilder bob = - std::move(BSONObjBuilder() << "ns" << nss.ns() << "name" << name << "key" << key); + BSONObjBuilder bob = std::move(BSONObjBuilder() << "name" << name << "key" << key); if (!pathProjection.isEmpty()) bob << IndexDescriptor::kPathProjectionFieldName << pathProjection; |