I can't figure out how i set default language from Python/Pymongo.
From the mongo console I can create the Index that I want like this:
>> db.collection.createIndex({"column1": "text", "column2": "text"}, {"default_language": "none"})
From Python/Pymongo I can create the same text index, but without the "default_language" like this:
collection.create_index([("column1", "text"), ("column2", "text")])
I would like to set default_language also from the Pymongo call. How do I do that syntactically?
It's semi-documented; the documentation states:
See the MongoDB documentation for a full list of supported options by server version.
So it's as straightforward as passing it as an additional argument:
from pymongo import MongoClient, TEXT
db = MongoClient()['mydatabase']
db.mycollection.create_index(name='index1', keys=[('column1', TEXT), ('column2', TEXT)], default_language='none')