def compat_explain(cur):
    """
    Simulate MongoDB 3.0 explain result on prior versions.
    http://docs.mongodb.org/v3.0/reference/explain-results/
    """
    res = cur.explain()
    if 'nscannedObjects' in res:
        res['executionStats'] = dict(
            nReturned=res.pop('n'),
            totalKeysExamined=res.pop('nscanned'),
            totalDocsExamined=res.pop('nscannedObjects'),
            executionTimeMillis=res.pop('millis'),
        )
    return res
Simulate MongoDB 3.0 explain result on prior versions.
    http://docs.mongodb.org/v3.0/reference/explain-results/