[SERVER-12699] Running the same createIndexes command twice with a text index, produces an odd error Created: 12/Feb/14  Updated: 10/Dec/14  Resolved: 12/Feb/14

Status: Closed
Project: Core Server
Component/s: Index Maintenance
Affects Version/s: 2.5.5
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Derick Rethans Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-10879 ensureIndex() on existing text index ... Closed
Operating System: ALL
Participants:

 Description   

When creating a duplicate normal index twice, you simply get a notification in the command return structure that tells you no indexes were created:

> db.col1.runCommand({ 'createIndexes' : 'col1', indexes: [ { name: "e_1", key: { e: 1 } } ] } );
{
	"createdCollectionAutomatically" : false,
	"numIndexesBefore" : 2,
	"numIndexesAfter" : 3,
	"ok" : 1
}
> db.col1.runCommand({ 'createIndexes' : 'col1', indexes: [ { name: "e_1", key: { e: 1 } } ] } );
{
	"numIndexesBefore" : 3,
	"note" : "all indexes already exist",
	"noChangesMade" : true,
	"ok" : 1
}

But when we do this with a "text" column, then it fails with an error:

 
> db.col1.runCommand({ 'createIndexes' : 'col1', indexes: [ { name: "d_1", key: { d: 'text' } } ] } );
{
	"createdCollectionAutomatically" : true,
	"numIndexesBefore" : 1,
	"numIndexesAfter" : 2,
	"ok" : 1
}
> db.col1.runCommand({ 'createIndexes' : 'col1', indexes: [ { name: "d_1", key: { d: 'text' } } ] } );
{
	"ok" : 0,
	"errmsg" : "Trying to create an index with same name d_1 with different key spec { d: \"text\" } vs existing spec { _fts: \"text\", _ftsx: 1 }",
	"code" : 67
}



 Comments   
Comment by J Rassi [ 12/Feb/14 ]

Resolving as dup of SERVER-10879.

Generated at Thu Feb 08 03:29:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.