def document_to_dict(instance, fields=None, exclude=None):
    # avoid a circular import
    structure = instance.structure

    data = {}
    for field_name in structure.keys():
        if fields and not field_name in fields:
            continue
        if exclude and field_name in exclude:
            continue
        data[field_name] = value_from_document(instance, field_name)

    return data
Test filter when performing a all request
dataset/ETHPy150Open peterbe/django-mongokit/django_mongokit/forms/forms.py/document_to_dict--crossover with--dataset/ETHPy150Open lsbardel/python-stdnet/tests/all/query/manager.py/TestManager.testContainsAll