I am trying to play with text index on Mongodb.
I already used a text index in one collection:
db.ensureIndex({field1 : "text"})
and it works.
But I repeated another collection, and I received 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 }
In the collection "films" there is a field of "genres", which is an array of strings. For instance:
> db.movies.findOne() { "_id" : ObjectId("51c460fdc30a209dd9621dc4"), "genres" : [ "Crime", "Drama" ] ... }
This field is present in all documents.
I do not understand this error. Any ideas?
source share