Example:
>> cursor = collection.find({'name': 'foo'}).hint('nonexistent_index_name')
>> cursor
<pymongo.cursor.Cursor>The query returns a Cursor, but calling anything with the cursor:
>> cursor.count()or
>> list(cursor)Results in the error:
File "/python-2.7/lib/python2.7/site-packages/pymongo/cursor.py", line 1176, in next
if len(self.__data) or self._refresh():
File "/python-2.7/lib/python2.7/site-packages/pymongo/cursor.py", line 1087, in _refresh
self.__send_message(q)
File "/python-2.7/lib/python2.7/site-packages/pymongo/cursor.py", line 974, in __send_message
helpers._check_command_response(first)
File "/python-2.7/lib/python2.7/site-packages/pymongo/helpers.py", line 146, in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
pymongo.errors.OperationFailure: error processing query: ns=collection_nameTree: name == "foo"
Sort: {}
Proj: {}
planner returned error: bad hintThis query returns the expected result when I use an existing index name, or use no hint:
>> cursor = collection.find({'name': 'foo'}).hint('existing_index_name')
>> list(cursor)
[{'name': 'foo'}]
>> cursor = collection.find({'name': 'foo'})
>> list(cursor)
[{'name': 'foo'}]
Am I doing something wrong?