FastFoodCoding

Login


Connect with one of the following accounts





Login

Please wait while we redirect...

Views: 559 Ask New Question


I have two columns title & content. As of today I have added text index on my title column and today i am trying to add another index for content column but I am getting the following exception while doing it

> db.posts.createIndex({"title":"text","content":"text", "description":"text"})
{
    "ok" : 0,
    "errmsg" : "Index: { v: 2, key: { _fts: \"text\", _ftsx: 1 }, name: \"title_text_content_text_description_text\", ns: \"stress-test.posts\", weights: { content: 1, description: 1, title: 1 }, default_language: \"english\", language_override: \"language\", textIndexVersion: 3 } already exists with different options: { v: 2, key: { _fts: \"text\", _ftsx: 1 }, name: \"title_text\", ns: \"stress-test.posts\", weights: { title: 1 }, default_language: \"english\", language_override: \"language\", textIndexVersion: 3 }",
    "code" : 85,
    "codeName" : "IndexOptionsConflict"
}
On By


1 Answer


To do this, you need to drop the current text index and create a new text index with all the columns you need.
Run the following steps to do that

db.posts.dropIndex("title_text") 
db.posts.createIndex({"title":"text","content":"text", "description":"text"})
On By


Answer This Question


Top Tutorials

Top Questions

Top Articles

Top Blogs

Top News