MongoEngine/mongoengine — pull request #663 by scttl (2014-06-11 17:47:57+00:00)
Title: Correct $maxDistance placement for $near queries.

Per http://docs.mongodb.org/manual/release-notes/2.6-compatibility/
$maxDistance must now be located within the $near query, not outside.

Note that this fix is still compatible with mongoDB < 2.6