summaryrefslogtreecommitdiff
path: root/jstests/core/fts_index2.js
blob: ecae5edb3a8f3cec981246d9766e123ede9367f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// Cannot implicitly shard accessed collections because renameCollection command not supported
// on sharded collections.
// @tags: [assumes_unsharded_collection]

// 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.writeOK(coll1.insert({a: {b: "some content"}}));
assert.commandWorked(coll1.ensureIndex({"$**": "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"}}));