MongoEngine/mongoengine — pull request #833 by balkian (2014-12-16 14:00:20+00:00)
Title: Fix #714, rebase version of #827

The original commit to fix #714 was months old, so I rebased the changes from the updated master branch.

All tests pass in my environment, except for two that I couldn't get to work in mongoengine/master either:

```
ERROR: test_queryset_aggregation_framework (tests.QuerySetTest)
----------------------------------------------------------------------
OperationFailure: command SON([('aggregate', u'person'), ('pipeline', [{'$match': {'age': {'$lte': 22}}}, {'$project': {'name': {'$toUpper': '$name'}}}]), ('cursor', {})]) failed: unrecognized field "cursor

ERROR: test_text_indexes (tests.IndexesTest)
----------------------------------------------------------------------
OperationFailure: text search not enabled
```