I have similar code as in PyMongo documentation on cursors here https://api.mongodb.org/python/current/api/pymongo/cursor.html
Here is the code from doc page.
cursor = db.test.find(
{'$text': {'$search': 'some words'}},
{'score': {'$meta': 'textScore'}})
When I run this code with Windows Python 2.7 PyMongo 3.0.3 and also 3.0.2 I get the following MongoDB error "OperationFailure: database error: Can't canonicalize query: BadValue unknown operator: $meta". Looking at the cause I was able reproduce this error if I use MongoDB client and put "{'score': {'$meta': 'textScore'}}" before "$text", like this.
db.test.find({ score: { $meta: "textScore" } }, { $text: { $search: "some words" }})
Back in Python, if I print dictionary with query keys I see "score" key first and "$text" key second. I guess this is causing PyMongo to form wrong query and subsequently an error in find methos.
Is there a work around for this issue?
Thanks