summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/index_version_v2.js
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2017-06-02 15:29:32 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2017-06-09 15:05:04 -0400
commit67500efdc1c677173c737ecde2b07b42015ae5fd (patch)
tree4a735cf4c6561e28b76f65117d47231e9a677d04 /jstests/noPassthrough/index_version_v2.js
parentf9c36696a25d3837f512421755952736236bbed0 (diff)
downloadmongo-67500efdc1c677173c737ecde2b07b42015ae5fd.tar.gz
SERVER-29350 Bump featureCompatibilityVersion to 3.6
Diffstat (limited to 'jstests/noPassthrough/index_version_v2.js')
-rw-r--r--jstests/noPassthrough/index_version_v2.js143
1 files changed, 12 insertions, 131 deletions
diff --git a/jstests/noPassthrough/index_version_v2.js b/jstests/noPassthrough/index_version_v2.js
index 3b90b24109d..e84f206394a 100644
--- a/jstests/noPassthrough/index_version_v2.js
+++ b/jstests/noPassthrough/index_version_v2.js
@@ -1,7 +1,5 @@
/**
- * Tests the interaction of the default index version and the featureCompatibilityVersion:
- * - Index version v=2 is the default when the featureCompatibilityVersion is 3.4
- * - Index version v=1 is the default when the featureCompatibilityVersion is 3.2
+ * Tests that index version v=2 is the default.
*
* Additionally, this file tests that index version v=2 is required to create an index with a
* collation and that index version v=2 is required to index decimal data on storage engines using
@@ -12,12 +10,6 @@
const storageEnginesUsingKeyString = new Set(["wiredTiger", "inMemory", "rocksdb"]);
- function getFeatureCompatibilityVersion(conn) {
- const res = assert.commandWorked(
- conn.adminCommand({getParameter: 1, featureCompatibilityVersion: 1}));
- return res.featureCompatibilityVersion;
- }
-
function getIndexSpecByName(coll, indexName) {
const indexes = coll.getIndexes();
const indexesFilteredByName = indexes.filter(spec => spec.name === indexName);
@@ -29,57 +21,52 @@
const conn = MongoRunner.runMongod({});
assert.neq(null, conn, "mongod was unable to start up");
- assert.eq("3.4", getFeatureCompatibilityVersion(conn));
const testDB = conn.getDB("test");
const storageEngine = testDB.serverStatus().storageEngine.name;
//
- // Index version v=2 and featureCompatibilityVersion=3.4
+ // Index version v=2
//
testDB.dropDatabase();
- // Test that the _id index of a collection is created with v=2 when the
- // featureCompatibilityVersion is 3.4.
+ // Test that the _id index of a collection is created with v=2 by default.
assert.commandWorked(testDB.runCommand({create: "index_version"}));
let indexSpec = getIndexSpecByName(testDB.index_version, "_id_");
assert.eq(2, indexSpec.v, tojson(indexSpec));
- // Test that an index created on an existing collection is created with v=2 when the
- // featureCompatibilityVersion is 3.4.
+ // Test that an index created on an existing collection is created with v=2 by default.
assert.commandWorked(testDB.index_version.createIndex({defaultToV2: 1}, {name: "defaultToV2"}));
indexSpec = getIndexSpecByName(testDB.index_version, "defaultToV2");
assert.eq(2, indexSpec.v, tojson(indexSpec));
- // Test that creating an index with v=2 succeeds when the featureCompatibilityVersion is 3.4.
+ // Test that creating an index with v=2 succeeds.
assert.commandWorked(testDB.index_version.createIndex({withV2: 1}, {v: 2, name: "withV2"}));
indexSpec = getIndexSpecByName(testDB.index_version, "withV2");
assert.eq(2, indexSpec.v, tojson(indexSpec));
- // Test that creating a collection with a non-simple default collation succeeds when the
- // featureCompatibilityVersion is 3.4.
+ // Test that creating a collection with a non-simple default collation succeeds.
assert.commandWorked(testDB.runCommand({create: "collation", collation: {locale: "en"}}));
indexSpec = getIndexSpecByName(testDB.collation, "_id_");
assert.eq(2, indexSpec.v, tojson(indexSpec));
- // Test that creating an index with a non-simple collation succeeds when the
- // featureCompatibilityVersion is 3.4.
+ // Test that creating an index with a non-simple collation succeeds.
assert.commandWorked(
testDB.collation.createIndex({str: 1}, {name: "withCollation", collation: {locale: "fr"}}));
indexSpec = getIndexSpecByName(testDB.collation, "withCollation");
assert.eq(2, indexSpec.v, tojson(indexSpec));
- // Test that indexing decimal data succeeds when the featureCompatibilityVersion is 3.4.
+ // Test that indexing decimal data succeeds.
assert.writeOK(testDB.decimal.insert({_id: new NumberDecimal("42")}));
//
- // Index version v=1 and featureCompatibilityVersion=3.4
+ // Index version v=1
//
testDB.dropDatabase();
- // Test that creating an index with v=1 succeeds when the featureCompatibilityVersion is 3.4.
+ // Test that creating an index with v=1 succeeds.
assert.commandWorked(testDB.index_version.createIndex({withV1: 1}, {v: 1, name: "withV1"}));
indexSpec = getIndexSpecByName(testDB.index_version, "withV1");
assert.eq(1, indexSpec.v, tojson(indexSpec));
@@ -117,113 +104,7 @@
}
//
- // Index version v=0 and featureCompatibilityVersion=3.4
- //
-
- testDB.dropDatabase();
-
- // Test that attempting to create an index with v=0 returns an error.
- assert.commandFailed(testDB.index_version.createIndex({withV0: 1}, {v: 0}));
-
- //
- // Index version v=3 and featureCompatibilityVersion=3.4
- //
-
- testDB.dropDatabase();
-
- // Test that attempting to create an index with v=3 returns an error.
- assert.commandFailed(testDB.index_version.createIndex({withV3: 1}, {v: 3}));
-
- //
- // Index version v=1 and featureCompatibilityVersion=3.2
- //
-
- // Set the featureCompatibilityVersion to 3.2.
- assert.commandWorked(conn.adminCommand({setFeatureCompatibilityVersion: "3.2"}));
- assert.eq("3.2", getFeatureCompatibilityVersion(conn));
- testDB.dropDatabase();
-
- // Test that the _id index of a collection is created with v=1 when the
- // featureCompatibilityVersion is 3.2.
- assert.commandWorked(testDB.runCommand({create: "index_version"}));
- indexSpec = getIndexSpecByName(testDB.index_version, "_id_");
- assert.eq(1, indexSpec.v, tojson(indexSpec));
-
- // Test that the _id index of a collection is created with v=1 when the
- // featureCompatibilityVersion is 3.2 and an "idIndex" spec is provided without a version.
- testDB.index_version.drop();
- assert.commandWorked(
- testDB.runCommand({create: "index_version", idIndex: {key: {_id: 1}, name: "_id_"}}));
- indexSpec = getIndexSpecByName(testDB.index_version, "_id_");
- assert.eq(1, indexSpec.v, tojson(indexSpec));
-
- // Test that an index created on an existing collection is created with v=1 when the
- // featureCompatibilityVersion is 3.2.
- assert.commandWorked(testDB.index_version.createIndex({defaultToV1: 1}, {name: "defaultToV1"}));
- indexSpec = getIndexSpecByName(testDB.index_version, "defaultToV1");
- assert.eq(1, indexSpec.v, tojson(indexSpec));
-
- // Test that creating an index with v=1 succeeds when the featureCompatibilityVersion is 3.2.
- assert.commandWorked(testDB.index_version.createIndex({withV1: 1}, {v: 1, name: "withV1"}));
- indexSpec = getIndexSpecByName(testDB.index_version, "withV1");
- assert.eq(1, indexSpec.v, tojson(indexSpec));
-
- // Test that creating a collection with a non-simple default collation returns an error when the
- // featureCompatibilityVersion is 3.2.
- assert.commandFailed(testDB.runCommand({create: "collation", collation: {locale: "en"}}));
-
- // Test that creating an index with a non-simple collation returns an error when the
- // featureCompatibilityVersion is 3.2.
- assert.commandFailed(testDB.collation.createIndex({str: 1}, {collation: {locale: "fr"}}));
-
- // Test that creating a collection with a non-simple default collation and without an _id index
- // succeeds when the featureCompatibilityVersion is 3.2.
- testDB.collation.drop();
- assert.commandFailed(
- testDB.runCommand({create: "collation", collation: {locale: "en"}, autoIndexId: false}));
-
- // Test that creating a collection with a simple default collation and without an _id index
- // succeeds when the featureCompatibilityVersion is 3.2.
- testDB.collation.drop();
- assert.commandFailed(testDB.runCommand(
- {create: "collation", collation: {locale: "simple"}, autoIndexId: false}));
-
- // Test that creating a collection with a simple default collation succeeds when the
- // featureCompatibilityVersion is 3.2.
- testDB.collation.drop();
- assert.commandFailed(testDB.runCommand({create: "collation", collation: {locale: "simple"}}));
-
- // Test that creating an index with a simple collation returns an error when the
- // featureCompatibilityVersion is 3.2.
- assert.commandFailed(testDB.collation.createIndex(
- {str: 1}, {name: "withSimpleCollation", collation: {locale: "simple"}}));
-
- // Test that inserting decimal data (both indexed and unindexed) returns an error when the
- // featureCompatibilityVersion is 3.2.
- assert.writeErrorWithCode(testDB.decimal.insert({_id: new NumberDecimal("42")}),
- ErrorCodes.InvalidBSON);
- assert.writeErrorWithCode(testDB.decimal.insert({num: new NumberDecimal("42")}),
- ErrorCodes.InvalidBSON);
-
- //
- // Index version v=2 and featureCompatibilityVersion=3.2
- //
-
- testDB.dropDatabase();
-
- // Test that attempting to create an index with v=2 when the featureCompatibilityVersion is 3.2
- // returns an error.
- assert.commandFailed(testDB.index_version.createIndex({withV2: 1}, {v: 2, name: "withV2"}));
-
- testDB.dropDatabase();
-
- // Test that attempting to create an _id index with v=2 when the featureCompatibilityVersion is
- // 3.2 returns an error.
- assert.commandFailed(
- testDB.runCommand({create: "index_version", idIndex: {key: {_id: 1}, name: "_id_", v: 2}}));
-
- //
- // Index version v=0 and featureCompatibilityVersion=3.2
+ // Index version v=0
//
testDB.dropDatabase();
@@ -232,7 +113,7 @@
assert.commandFailed(testDB.index_version.createIndex({withV0: 1}, {v: 0}));
//
- // Index version v=3 and featureCompatibilityVersion=3.2
+ // Index version v=3
//
testDB.dropDatabase();