Reputation: 209
I want to create a text index on a collection having documents with String fields. However, this command:
coll_events.ensureIndex(new BasicDBObject("$**", "text"));
However, this is returning the following error: Can't canonicalize query: BadValue unknown operator: $**
I have enabled the textSearchEnabled=true in the setParameter option also.
Edit 1: I have tried the same command (it's equivalent) in the Mongo Shell given for windows as:
coll_event.ensureIndex({"$**": "text"})
This command works fine. So I think the problem should be somewhere in the mongodb java driver.
Upvotes: 1
Views: 676
Reputation: 11671
This is a resolved issue JAVA-814 fixed in 2.11.2/2.12. Please update the driver to an appropriate version and then your attempts to index all string fields with $**
should succeed.
Upvotes: 1