Had the same problem, managed to solve the problem (pymongo), using the $ meta operator material instead of runCommand:
# create text index db.collection.ensure_index([("textField", "text")], name = "Text_search_index") # query queryDict = { "$text": { "$search": ""science"}} # cursor cursor = db.collection.find(queryDict, {'score': {'$meta': 'textScore'}, "_id":1}).sort([('score', {'$meta': 'textScore'})]).limit(limit_value)
It looks like this is only available from version 2.6 , at least in pymongo
Also in the Mongo shell, this is equivalent to:
db.collection.ensureIndex({"textField":"text"}) queryDict = { "$text": { "$search": "science"}} db.collection.find(queryDict, {'score': {'$meta': 'textScore'}}).sort({'score': {'$met a': 'textScore'}}).limit(100)
source share