I'm trying to play with text index on Mongodb.
I already used a text index on one collection :
db.ensureIndex({field1 : "text"})
and it works.
But I retried on another collection and I get the following message :
db.movies.ensureIndex({genres: "text"})
{
"createdCollectionAutomatically" : false,
"numIndexesBefore" : 1,
"ok" : 0,
"errmsg" : "found language override field in document with non-string type",
"code" : 17261
}
The collection "movies" has a "genres" field which is an array of string. For example :
> db.movies.findOne()
{
"_id" : ObjectId("51c460fdc30a209dd9621dc4"),
"genres" : [
"Crime",
"Drama"
]
...
}
This field is present on all documents.
I don't understand this error. Any idea ?
db.movies.getIndexes()show? Also show the full movies document. It seems that themoviesdocument has a field namedlanguagewith a array type value.