Adding (passing) unit test from https://github.com/MongoEngine/mongoengine/pull/368