I have a database of English words stored in the field 'h'. I've just found out about text indexes and I wanna create one on this field to speed up searching by regex, but somehow, I just can't get the syntax right. I'm using pymongo 2.7.1 and python 3.4.
from pymongo import MongoClient
from pymongo import ASCENDING
from pymongo import DESCENDING
from pymongo import TEXT
#...
collection.create_index('h', TEXT)
And I'm getting the following error:
in create_index
raise TypeError("cache_for must be an integer or float.")
TypeError: cache_for must be an integer or float.
Note that ASCENDING and DESCENDING work. Also I'd like to set the default language as English.