summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2016-09-14 20:49:17 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2016-09-14 20:49:17 -0400
commit8302d0735b34a16cac000e5e345722487536e5bc (patch)
treec9ef60fe493eda60feacddfd67c0ec298939c4ef /src/mongo/db/catalog
parent46acb1b94944bc7aa68ff6a8b3cd2d340b272c6f (diff)
downloadmongo-8302d0735b34a16cac000e5e345722487536e5bc.tar.gz
SERVER-24033 Write full index spec in oplog entry for index creation.
This ensures that the index version (aka the "v" field) is always present in the oplog entry when creating indexes on a 3.4 primary. We can therefore assume that if the "v" field isn't present in the corresponding oplog entry, then a v=1 index should be built. Changes MultiBlockIndex::init() to return the index specifications that were actually created. The "repairDatabase", "compact", "copydb", and "cloneCollection" commands no longer automatically upgrade the index version to the current default version. Instead, the only command that does so is the "reIndex" command.
Diffstat (limited to 'src/mongo/db/catalog')
-rw-r--r--src/mongo/db/catalog/collection_compact.cpp36
-rw-r--r--src/mongo/db/catalog/database.cpp14
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp123
-rw-r--r--src/mongo/db/catalog/index_catalog.h4
-rw-r--r--src/mongo/db/catalog/index_create.cpp10
-rw-r--r--src/mongo/db/catalog/index_create.h7
-rw-r--r--src/mongo/db/catalog/index_key_validate.cpp40
7 files changed, 123 insertions, 111 deletions
diff --git a/src/mongo/db/catalog/collection_compact.cpp b/src/mongo/db/catalog/collection_compact.cpp
index afba5e94987..a89ce69fbd7 100644
--- a/src/mongo/db/catalog/collection_compact.cpp
+++ b/src/mongo/db/catalog/collection_compact.cpp
@@ -42,6 +42,7 @@
#include "mongo/db/commands/server_status.h"
#include "mongo/db/curop.h"
#include "mongo/db/index/index_access_method.h"
+#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/operation_context.h"
#include "mongo/util/log.h"
#include "mongo/util/touch_pages.h"
@@ -51,25 +52,32 @@ namespace mongo {
using std::endl;
using std::vector;
+using IndexVersion = IndexDescriptor::IndexVersion;
+
namespace {
BSONObj _compactAdjustIndexSpec(const BSONObj& oldSpec) {
- BSONObjBuilder b;
- BSONObj::iterator i(oldSpec);
- while (i.more()) {
- BSONElement e = i.next();
- if (str::equals(e.fieldName(), "v")) {
- // Drop any preexisting index version spec. The default index version will
- // be used instead for the new index.
- continue;
- }
- if (str::equals(e.fieldName(), "background")) {
+ BSONObjBuilder bob;
+
+ for (auto&& indexSpecElem : oldSpec) {
+ auto indexSpecElemFieldName = indexSpecElem.fieldNameStringData();
+ if (IndexDescriptor::kIndexVersionFieldName == indexSpecElemFieldName) {
+ IndexVersion indexVersion = static_cast<IndexVersion>(indexSpecElem.numberInt());
+ if (IndexVersion::kV0 == indexVersion) {
+ // We automatically upgrade v=0 indexes to v=1 indexes.
+ bob.append(IndexDescriptor::kIndexVersionFieldName,
+ static_cast<int>(IndexVersion::kV1));
+ } else {
+ bob.append(IndexDescriptor::kIndexVersionFieldName, static_cast<int>(indexVersion));
+ }
+ } else if (IndexDescriptor::kBackgroundFieldName == indexSpecElemFieldName) {
// Create the new index in the foreground.
continue;
+ } else {
+ bob.append(indexSpecElem);
}
- // Pass the element through to the new index spec.
- b.append(e);
}
- return b.obj();
+
+ return bob.obj();
}
class MyCompactAdaptor : public RecordStoreCompactAdaptor {
@@ -182,7 +190,7 @@ StatusWith<CompactStats> Collection::compact(OperationContext* txn,
indexer.allowInterruption();
indexer.ignoreUniqueConstraint(); // in compact we should be doing no checking
- Status status = indexer.init(indexSpecs);
+ Status status = indexer.init(indexSpecs).getStatus();
if (!status.isOK())
return StatusWith<CompactStats>(status);
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp
index feb4111edac..005a4f23abf 100644
--- a/src/mongo/db/catalog/database.cpp
+++ b/src/mongo/db/catalog/database.cpp
@@ -56,6 +56,7 @@
#include "mongo/db/query/collation/collator_factory_interface.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/replication_coordinator_global.h"
+#include "mongo/db/server_options.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/service_context.h"
#include "mongo/db/service_context_d.h"
@@ -576,8 +577,19 @@ Collection* Database::createCollection(OperationContext* txn,
if (collection->requiresIdIndex()) {
if (options.autoIndexId == CollectionOptions::YES ||
options.autoIndexId == CollectionOptions::DEFAULT) {
+ // The creation of the _id index isn't replicated and is instead implicit in the
+ // creation of the collection. This means that the version of the _id index to build
+ // is technically unspecified. However, we're able to use the
+ // featureCompatibilityVersion of this server to determine the default index version
+ // to use because we apply commands (opType == 'c') in their own batch. This
+ // guarantees the write to the admin.system.version collection from the
+ // "setFeatureCompatibilityVersion" command either happens entirely before the
+ // collection creation or it happens entirely after.
+ const auto featureCompatibilityVersion =
+ serverGlobalParams.featureCompatibilityVersion.load();
IndexCatalog* ic = collection->getIndexCatalog();
- uassertStatusOK(ic->createIndexOnEmptyCollection(txn, ic->getDefaultIdIndexSpec()));
+ uassertStatusOK(ic->createIndexOnEmptyCollection(
+ txn, ic->getDefaultIdIndexSpec(featureCompatibilityVersion)));
}
}
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index 02158d2d6db..123f7722024 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -59,6 +59,7 @@
#include "mongo/db/matcher/extensions_callback_disallow_extensions.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/ops/delete.h"
+#include "mongo/db/query/collation/collation_spec.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/repl/replication_coordinator_global.h"
@@ -468,36 +469,41 @@ Status IndexCatalog::_isSpecOk(OperationContext* txn, const BSONObj& spec) const
const NamespaceString& nss = _collection->ns();
BSONElement vElt = spec["v"];
- if (!vElt.eoo()) {
- if (!vElt.isNumber()) {
- return Status(ErrorCodes::CannotCreateIndex,
- str::stream() << "non-numeric value for \"v\" field: " << vElt);
- }
+ if (!vElt) {
+ return {ErrorCodes::InternalError,
+ str::stream()
+ << "An internal operation failed to specify the 'v' field, which is a required "
+ "property of an index specification: "
+ << spec};
+ }
- auto vEltAsInt = representAs<int>(vElt.number());
- if (!vEltAsInt) {
- return {
- ErrorCodes::CannotCreateIndex,
+ if (!vElt.isNumber()) {
+ return Status(ErrorCodes::CannotCreateIndex,
+ str::stream() << "non-numeric value for \"v\" field: " << vElt);
+ }
+
+ auto vEltAsInt = representAs<int>(vElt.number());
+ if (!vEltAsInt) {
+ return {ErrorCodes::CannotCreateIndex,
str::stream() << "Index version must be representable as a 32-bit integer, but got "
<< vElt.toString(false, false)};
- }
+ }
- auto indexVersion = static_cast<IndexVersion>(*vEltAsInt);
+ auto indexVersion = static_cast<IndexVersion>(*vEltAsInt);
- // SERVER-16893 Forbid use of v0 indexes with non-mmapv1 engines
- if (indexVersion == IndexVersion::kV0 &&
- !txn->getServiceContext()->getGlobalStorageEngine()->isMmapV1()) {
- return Status(ErrorCodes::CannotCreateIndex,
- str::stream() << "use of v0 indexes is only allowed with the "
- << "mmapv1 storage engine");
- }
+ // SERVER-16893 Forbid use of v0 indexes with non-mmapv1 engines
+ if (indexVersion == IndexVersion::kV0 &&
+ !txn->getServiceContext()->getGlobalStorageEngine()->isMmapV1()) {
+ return Status(ErrorCodes::CannotCreateIndex,
+ str::stream() << "use of v0 indexes is only allowed with the "
+ << "mmapv1 storage engine");
+ }
- if (!IndexDescriptor::isIndexVersionSupported(indexVersion)) {
- return Status(ErrorCodes::CannotCreateIndex,
- str::stream() << "this version of mongod cannot build new indexes "
- << "of version number "
- << static_cast<int>(indexVersion));
- }
+ if (!IndexDescriptor::isIndexVersionSupported(indexVersion)) {
+ return Status(ErrorCodes::CannotCreateIndex,
+ str::stream() << "this version of mongod cannot build new indexes "
+ << "of version number "
+ << static_cast<int>(indexVersion));
}
if (nss.isSystemDotIndexes())
@@ -566,7 +572,15 @@ Status IndexCatalog::_isSpecOk(OperationContext* txn, const BSONObj& spec) const
}
collator = std::move(statusWithCollator.getValue());
- if (vElt && static_cast<IndexVersion>(vElt.numberInt()) < IndexVersion::kV2) {
+ if (!collator) {
+ return {ErrorCodes::InternalError,
+ str::stream() << "An internal operation specified the collation "
+ << CollationSpec::kSimpleSpec
+ << " explicitly, which should instead be implied by omitting the "
+ "'collation' field from the index specification"};
+ }
+
+ if (static_cast<IndexVersion>(vElt.numberInt()) < IndexVersion::kV2) {
return {ErrorCodes::CannotCreateIndex,
str::stream() << "Index version " << vElt.fieldNameStringData() << "="
<< vElt.numberInt()
@@ -576,8 +590,8 @@ Status IndexCatalog::_isSpecOk(OperationContext* txn, const BSONObj& spec) const
}
string pluginName = IndexNames::findPluginName(key);
- if (collator && (pluginName != IndexNames::BTREE) &&
- (pluginName != IndexNames::GEO_2DSPHERE) && (pluginName != IndexNames::HASHED)) {
+ if ((pluginName != IndexNames::BTREE) && (pluginName != IndexNames::GEO_2DSPHERE) &&
+ (pluginName != IndexNames::HASHED)) {
return Status(ErrorCodes::CannotCreateIndex,
str::stream() << "Index type '" << pluginName
<< "' does not support collation: "
@@ -769,13 +783,21 @@ Status IndexCatalog::_doesSpecConflictWithExisting(OperationContext* txn,
return Status::OK();
}
-BSONObj IndexCatalog::getDefaultIdIndexSpec() const {
+BSONObj IndexCatalog::getDefaultIdIndexSpec(
+ ServerGlobalParams::FeatureCompatibilityVersions featureCompatibilityVersion) const {
dassert(_idObj["_id"].type() == NumberInt);
+ const auto indexVersion = IndexDescriptor::getDefaultIndexVersion(featureCompatibilityVersion);
+
BSONObjBuilder b;
+ b.append("v", static_cast<int>(indexVersion));
b.append("name", "_id_");
b.append("ns", _collection->ns().ns());
b.append("key", _idObj);
+ if (_collection->getDefaultCollator() && indexVersion >= IndexVersion::kV2) {
+ // Creating an index with the "collation" option requires a v=2 index.
+ b.append("collation", _collection->getDefaultCollator()->getSpec().toBSON());
+ }
return b.obj();
}
@@ -1353,16 +1375,12 @@ StatusWith<BSONObj> IndexCatalog::_fixIndexSpec(OperationContext* txn,
BSONObjBuilder b;
- auto indexVersion = IndexDescriptor::getDefaultIndexVersion(
- serverGlobalParams.featureCompatibilityVersion.load());
- if (!o["v"].eoo()) {
- // We've already verified in IndexCatalog::_isSpecOk() that the index version is
- // representable as a 32-bit integer.
- indexVersion = static_cast<IndexVersion>(o["v"].numberInt());
- }
+ // We've already verified in IndexCatalog::_isSpecOk() that the index version is present and
+ // that it is representable as a 32-bit integer.
+ auto vElt = o["v"];
+ invariant(vElt);
- // idea is to put things we use a lot earlier
- b.append("v", static_cast<int>(indexVersion));
+ b.append("v", vElt.numberInt());
if (o["unique"].trueValue())
b.appendBool("unique", true); // normalize to bool true in case was int 1 or something...
@@ -1376,35 +1394,6 @@ StatusWith<BSONObj> IndexCatalog::_fixIndexSpec(OperationContext* txn,
}
b.append("name", name);
- if (auto collationElt = spec["collation"]) {
- // This should already have been verified by _isSpecOk().
- invariant(collationElt.type() == BSONType::Object);
-
- auto collator = CollatorFactoryInterface::get(txn->getServiceContext())
- ->makeFromBSON(collationElt.Obj());
- if (!collator.isOK()) {
- return collator.getStatus();
- }
-
- // If the collator factory returned a non-null collator, set the collation option to the
- // result of serializing the collator's spec back into BSON. We do this in order to fill in
- // all options that the user omitted.
- //
- // If the collator factory returned a null collator (representing the "simple" collation),
- // we simply omit the "collation" from the index spec. This ensures that indices with the
- // simple collation built on versions which do not support the collation feature have the
- // same format for representing the simple collation as indices built on this version.
- if (collator.getValue()) {
- b.append("collation", collator.getValue()->getSpec().toBSON());
- }
- } else if (collection->getDefaultCollator() && indexVersion >= IndexVersion::kV2) {
- // The user did not specify an explicit collation for this index and the collection has a
- // default collator. If we're building a v=2 index, then we should inherit the collection
- // default. However, if we're building a v=1 index, then we're implicitly building an index
- // that's using the "simple" collation.
- b.append("collation", collection->getDefaultCollator()->getSpec().toBSON());
- }
-
{
BSONObjIterator i(o);
while (i.more()) {
@@ -1415,7 +1404,7 @@ StatusWith<BSONObj> IndexCatalog::_fixIndexSpec(OperationContext* txn,
// skip
} else if (s == "dropDups") {
// dropDups is silently ignored and removed from the spec as of SERVER-14710.
- } else if (s == "v" || s == "unique" || s == "key" || s == "name" || s == "collation") {
+ } else if (s == "v" || s == "unique" || s == "key" || s == "name") {
// covered above
} else {
b.append(e);
diff --git a/src/mongo/db/catalog/index_catalog.h b/src/mongo/db/catalog/index_catalog.h
index 37ec3305615..4ff19ddd60f 100644
--- a/src/mongo/db/catalog/index_catalog.h
+++ b/src/mongo/db/catalog/index_catalog.h
@@ -37,6 +37,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/record_id.h"
+#include "mongo/db/server_options.h"
#include "mongo/db/storage/record_store.h"
#include "mongo/platform/unordered_map.h"
@@ -81,7 +82,8 @@ public:
/**
* Returns the spec for the id index to create by default for this collection.
*/
- BSONObj getDefaultIdIndexSpec() const;
+ BSONObj getDefaultIdIndexSpec(
+ ServerGlobalParams::FeatureCompatibilityVersions featureCompatibilityVersion) const;
IndexDescriptor* findIdIndex(OperationContext* txn) const;
diff --git a/src/mongo/db/catalog/index_create.cpp b/src/mongo/db/catalog/index_create.cpp
index 7f27589085d..8549b4f8b0c 100644
--- a/src/mongo/db/catalog/index_create.cpp
+++ b/src/mongo/db/catalog/index_create.cpp
@@ -147,12 +147,12 @@ void MultiIndexBlock::removeExistingIndexes(std::vector<BSONObj>* specs) const {
}
}
-Status MultiIndexBlock::init(const BSONObj& spec) {
+StatusWith<std::vector<BSONObj>> MultiIndexBlock::init(const BSONObj& spec) {
const auto indexes = std::vector<BSONObj>(1, spec);
return init(indexes);
}
-Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) {
+StatusWith<std::vector<BSONObj>> MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) {
WriteUnitOfWork wunit(_txn);
invariant(_indexes.empty());
@@ -182,6 +182,9 @@ Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) {
_buildInBackground = (_buildInBackground && info["background"].trueValue());
}
+ std::vector<BSONObj> indexInfoObjs;
+ indexInfoObjs.reserve(indexSpecs.size());
+
for (size_t i = 0; i < indexSpecs.size(); i++) {
BSONObj info = indexSpecs[i];
StatusWith<BSONObj> statusWithInfo =
@@ -190,6 +193,7 @@ Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) {
if (!status.isOK())
return status;
info = statusWithInfo.getValue();
+ indexInfoObjs.push_back(info);
IndexToBuild index;
index.block.reset(new IndexCatalog::IndexBuildBlock(_txn, _collection, info));
@@ -241,7 +245,7 @@ Status MultiIndexBlock::init(const std::vector<BSONObj>& indexSpecs) {
}
}
- return Status::OK();
+ return indexInfoObjs;
}
Status MultiIndexBlock::insertAllDocumentsInCollection(std::set<RecordId>* dupsOut) {
diff --git a/src/mongo/db/catalog/index_create.h b/src/mongo/db/catalog/index_create.h
index e5f18a42ed3..88dd5db8393 100644
--- a/src/mongo/db/catalog/index_create.h
+++ b/src/mongo/db/catalog/index_create.h
@@ -106,14 +106,15 @@ public:
void removeExistingIndexes(std::vector<BSONObj>* specs) const;
/**
- * Prepares the index(es) for building.
+ * Prepares the index(es) for building and returns the canonicalized form of the requested index
+ * specifications.
*
* Does not need to be called inside of a WriteUnitOfWork (but can be due to nesting).
*
* Requires holding an exclusive database lock.
*/
- Status init(const std::vector<BSONObj>& specs);
- Status init(const BSONObj& spec);
+ StatusWith<std::vector<BSONObj>> init(const std::vector<BSONObj>& specs);
+ StatusWith<std::vector<BSONObj>> init(const BSONObj& spec);
/**
* Inserts all documents in the Collection into the indexes and logs with timing info.
diff --git a/src/mongo/db/catalog/index_key_validate.cpp b/src/mongo/db/catalog/index_key_validate.cpp
index 44c2db2d5e7..c211d22b1d4 100644
--- a/src/mongo/db/catalog/index_key_validate.cpp
+++ b/src/mongo/db/catalog/index_key_validate.cpp
@@ -50,13 +50,6 @@ using std::string;
using IndexVersion = IndexDescriptor::IndexVersion;
-namespace {
-const StringData kKeyPatternFieldName = "key"_sd;
-const StringData kNamespaceFieldName = "ns"_sd;
-const StringData kVersionFieldName = "v"_sd;
-const StringData kCollationFieldName = "collation"_sd;
-} // namespace
-
Status validateKeyPattern(const BSONObj& key) {
const ErrorCodes::Error code = ErrorCodes::CannotCreateIndex;
@@ -158,10 +151,10 @@ StatusWith<BSONObj> validateIndexSpec(
for (auto&& indexSpecElem : indexSpec) {
auto indexSpecElemFieldName = indexSpecElem.fieldNameStringData();
- if (kKeyPatternFieldName == indexSpecElemFieldName) {
+ if (IndexDescriptor::kKeyPatternFieldName == indexSpecElemFieldName) {
if (indexSpecElem.type() != BSONType::Object) {
return {ErrorCodes::TypeMismatch,
- str::stream() << "The field '" << kKeyPatternFieldName
+ str::stream() << "The field '" << IndexDescriptor::kKeyPatternFieldName
<< "' must be an object, but got "
<< typeName(indexSpecElem.type())};
}
@@ -179,10 +172,10 @@ StatusWith<BSONObj> validateIndexSpec(
}
hasKeyPatternField = true;
- } else if (kNamespaceFieldName == indexSpecElemFieldName) {
+ } else if (IndexDescriptor::kNamespaceFieldName == indexSpecElemFieldName) {
if (indexSpecElem.type() != BSONType::String) {
return {ErrorCodes::TypeMismatch,
- str::stream() << "The field '" << kNamespaceFieldName
+ str::stream() << "The field '" << IndexDescriptor::kNamespaceFieldName
<< "' must be a string, but got "
<< typeName(indexSpecElem.type())};
}
@@ -190,13 +183,15 @@ StatusWith<BSONObj> validateIndexSpec(
StringData ns = indexSpecElem.valueStringData();
if (ns.empty()) {
return {ErrorCodes::BadValue,
- str::stream() << "The field '" << kNamespaceFieldName
+ str::stream() << "The field '" << IndexDescriptor::kNamespaceFieldName
<< "' cannot be an empty string"};
}
if (ns != expectedNamespace.ns()) {
return {ErrorCodes::BadValue,
- str::stream() << "The value of the field '" << kNamespaceFieldName << "' ("
+ str::stream() << "The value of the field '"
+ << IndexDescriptor::kNamespaceFieldName
+ << "' ("
<< ns
<< ") doesn't match the namespace '"
<< expectedNamespace.ns()
@@ -204,10 +199,10 @@ StatusWith<BSONObj> validateIndexSpec(
}
hasNamespaceField = true;
- } else if (kVersionFieldName == indexSpecElemFieldName) {
+ } else if (IndexDescriptor::kIndexVersionFieldName == indexSpecElemFieldName) {
if (!indexSpecElem.isNumber()) {
return {ErrorCodes::TypeMismatch,
- str::stream() << "The field '" << kVersionFieldName
+ str::stream() << "The field '" << IndexDescriptor::kIndexVersionFieldName
<< "' must be a number, but got "
<< typeName(indexSpecElem.type())};
}
@@ -230,10 +225,10 @@ StatusWith<BSONObj> validateIndexSpec(
hasVersionField = true;
resolvedIndexVersion = requestedIndexVersion;
- } else if (kCollationFieldName == indexSpecElemFieldName) {
+ } else if (IndexDescriptor::kCollationFieldName == indexSpecElemFieldName) {
if (indexSpecElem.type() != BSONType::Object) {
return {ErrorCodes::TypeMismatch,
- str::stream() << "The field '" << kNamespaceFieldName
+ str::stream() << "The field '" << IndexDescriptor::kNamespaceFieldName
<< "' must be an object, but got "
<< typeName(indexSpecElem.type())};
}
@@ -251,7 +246,7 @@ StatusWith<BSONObj> validateIndexSpec(
if (!hasKeyPatternField) {
return {ErrorCodes::FailedToParse,
- str::stream() << "The '" << kKeyPatternFieldName
+ str::stream() << "The '" << IndexDescriptor::kKeyPatternFieldName
<< "' field is a required property of an index specification"};
}
@@ -259,9 +254,9 @@ StatusWith<BSONObj> validateIndexSpec(
return {ErrorCodes::CannotCreateIndex,
str::stream() << "Invalid index specification " << indexSpec
<< "; cannot create an index with the '"
- << kCollationFieldName
+ << IndexDescriptor::kCollationFieldName
<< "' option and "
- << kVersionFieldName
+ << IndexDescriptor::kIndexVersionFieldName
<< "="
<< static_cast<int>(*resolvedIndexVersion)};
}
@@ -272,13 +267,14 @@ StatusWith<BSONObj> validateIndexSpec(
if (!hasNamespaceField) {
// We create a new index specification with the 'ns' field set as 'expectedNamespace' if
// the field was omitted.
- bob.append(kNamespaceFieldName, expectedNamespace.ns());
+ bob.append(IndexDescriptor::kNamespaceFieldName, expectedNamespace.ns());
}
if (!hasVersionField) {
// We create a new index specification with the 'v' field set as 'defaultIndexVersion'
// if the field was omitted.
- bob.append(kVersionFieldName, static_cast<int>(*resolvedIndexVersion));
+ bob.append(IndexDescriptor::kIndexVersionFieldName,
+ static_cast<int>(*resolvedIndexVersion));
}
bob.appendElements(indexSpec);