summaryrefslogtreecommitdiff
path: root/jstests/core/index/fts/fts_index2.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/core/index/fts/fts_index2.js')
-rw-r--r--jstests/core/index/fts/fts_index2.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/jstests/core/index/fts/fts_index2.js b/jstests/core/index/fts/fts_index2.js
new file mode 100644
index 00000000000..3ae6e45214e
--- /dev/null
+++ b/jstests/core/index/fts/fts_index2.js
@@ -0,0 +1,23 @@
+// Cannot implicitly shard accessed collections because renameCollection command not supported
+// on sharded collections.
+// @tags: [
+// assumes_unsharded_collection,
+// requires_non_retryable_commands,
+// ]
+
+// Test that collections with text indexes can be renamed. SERVER-14027.
+
+var coll1 = db.fts_index2;
+var coll2 = db.fts_index2.renamed;
+
+coll1.drop();
+coll2.drop();
+
+assert.commandWorked(coll1.insert({a: {b: "some content"}}));
+assert.commandWorked(coll1.createIndex({"$**": "text"}));
+assert.eq(1, coll1.count({$text: {$search: "content"}}));
+
+// Rename within same database.
+assert.commandWorked(
+ coll1.getDB().adminCommand({renameCollection: coll1.getFullName(), to: coll2.getFullName()}));
+assert.eq(1, coll2.count({$text: {$search: "content"}}));