diff options
author | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2018-05-29 22:00:53 -0400 |
---|---|---|
committer | Daniel Gottlieb <daniel.gottlieb@mongodb.com> | 2018-05-29 22:09:03 -0400 |
commit | 4616b071591bbe2fac69d57177d7b1c4c2ce8598 (patch) | |
tree | fbeb1fd5cf6a5a97e8f39091cfeb7cdcacc7bc7f /src/mongo/client | |
parent | 9f4401a7b20be1a4b6bd190f5b04919a6abf5645 (diff) | |
download | mongo-4616b071591bbe2fac69d57177d7b1c4c2ce8598.tar.gz |
SERVER-35070: Timestamp index completions individually.
(cherry picked from commit 39694ed5ee47848c3e51f8b739e9ccad8ca54c69)
Diffstat (limited to 'src/mongo/client')
-rw-r--r-- | src/mongo/client/dbclient.cpp | 8 | ||||
-rw-r--r-- | src/mongo/client/dbclientinterface.h | 8 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/mongo/client/dbclient.cpp b/src/mongo/client/dbclient.cpp index 3a7e95e819c..4455a371e13 100644 --- a/src/mongo/client/dbclient.cpp +++ b/src/mongo/client/dbclient.cpp @@ -1383,14 +1383,14 @@ string DBClientBase::genIndexName(const BSONObj& keys) { return ss.str(); } -void DBClientBase::createIndex(StringData ns, const IndexSpec& descriptor) { - const BSONObj descriptorObj = descriptor.toBSON(); - +void DBClientBase::createIndexes(StringData ns, const std::vector<const IndexSpec*>& descriptors) { BSONObjBuilder command; command.append("createIndexes", nsToCollectionSubstring(ns)); { BSONArrayBuilder indexes(command.subarrayStart("indexes")); - indexes.append(descriptorObj); + for (const auto& desc : descriptors) { + indexes.append(desc->toBSON()); + } } const BSONObj commandObj = command.done(); diff --git a/src/mongo/client/dbclientinterface.h b/src/mongo/client/dbclientinterface.h index 6048c89f348..a0b4782062b 100644 --- a/src/mongo/client/dbclientinterface.h +++ b/src/mongo/client/dbclientinterface.h @@ -637,7 +637,13 @@ public: * @param descriptor Configuration object describing the index to create. The * descriptor must describe at least one key and index type. */ - virtual void createIndex(StringData ns, const IndexSpec& descriptor); + virtual void createIndex(StringData ns, const IndexSpec& descriptor) { + std::vector<const IndexSpec*> toBuild; + toBuild.push_back(&descriptor); + createIndexes(ns, toBuild); + } + + virtual void createIndexes(StringData ns, const std::vector<const IndexSpec*>& descriptor); virtual std::list<BSONObj> getIndexSpecs(const std::string& ns, int options = 0); |