The upcoming MongoDB 2.4 supports full-text search.
We do this in the mongo shell with a command, such as
db.players.runCommand(\"text\", {
\"search\
An alternative solution is to use OrderedDict. Assuming collection and query are given as variables while additional parameters such as limit, projection and others given in the dict 'params':
params_ord = OrderedDict()
params_ord['text'] = collection
params_ord['search'] = query
for k,v in params.iteritems():
params_ord[k] = v
db.command(params_ord)