Skip to content

Bad returned type for Collection.index_information #39

@Guibod

Description

@Guibod

Mongita Collection returns a List[Dict], and should instead return a MutableMapping[str, Any]
See https://pymongo.readthedocs.io/en/stable/api/pymongo/collection.html#pymongo.collection.Collection.index_information

My suggested implementation:

def index_information(self):
    ret = {'_id_': {'key': [('_id', 1)]}}
    metadata = self._Collection__get_metadata()
    for idx in metadata.get('indexes', {}).values():
        ret[idx['_id']] = {'key': [(idx['key_str'], idx['direction'])]}
    return ret

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions