@@ -631,7 +631,7 @@ namespace mongo {
631631 // index already exists with same name
632632
633633 if ( !desc->keyPattern ().equal ( key ) )
634- return Status ( ErrorCodes::CannotCreateIndex ,
634+ return Status ( ErrorCodes::IndexKeySpecsConflict ,
635635 str::stream () << " Trying to create an index "
636636 << " with same name " << name
637637 << " with different key spec " << key
@@ -641,10 +641,9 @@ namespace mongo {
641641 _getAccessMethodName ( key ),
642642 spec );
643643 if ( !desc->areIndexOptionsEquivalent ( &temp ) )
644- return Status ( ErrorCodes::CannotCreateIndex ,
644+ return Status ( ErrorCodes::IndexOptionsConflict ,
645645 str::stream () << " Index with name: " << name
646- << " already exists with different options" ,
647- IndexOptionsDiffer);
646+ << " already exists with different options" );
648647
649648 // Index already exists with the same options, so no need to build a new
650649 // one (not an error). Most likely requested by a client using ensureIndex.
@@ -663,10 +662,9 @@ namespace mongo {
663662 _getAccessMethodName ( key ),
664663 spec );
665664 if ( !desc->areIndexOptionsEquivalent ( &temp ) )
666- return Status ( ErrorCodes::CannotCreateIndex ,
665+ return Status ( ErrorCodes::IndexOptionsConflict ,
667666 str::stream () << " Index with pattern: " << key
668- << " already exists with different options" ,
669- IndexOptionsDiffer );
667+ << " already exists with different options" );
670668
671669 return Status ( ErrorCodes::IndexAlreadyExists, name );
672670 }
@@ -690,7 +688,7 @@ namespace mongo {
690688 return Status ( ErrorCodes::CannotCreateIndex,
691689 str::stream () << " only one text index per collection allowed, "
692690 << " found existing text index \" " << textIndexes[0 ]->indexName ()
693- << " \" " );
691+ << " \" " );
694692 }
695693 }
696694 return Status::OK ();
0 commit comments