Skip to content

PYTHON-4834 Add __repr__ to pymongo.operations.IndexModel #154

@aclark4life

Description

@aclark4life

Via @timgraham

While checking --debug-sql output, I saw: db.schema_authorcharfieldwithindex.create_indexes([<pymongo.operations.IndexModel object at 0x7fa7285d0370>]) . I thought you might like to add a proper pymongo.operations.IndexModel.__repr__()  to improve this output. I'd like to see something like https://github.com/django/django/blob/4d11402932eca570850bdfa58a71eb59fc62275a/django/db/models/indexes.py#L193-L207.
indexes.py
    def __repr__(self):
        return "<%s:%s%s%s%s%s%s%s>" % (
            self.__class__.__qualname__,
            "" if not self.fields else " fields=%s" % repr(self.fields),
            "" if not self.expressions else " expressions=%s" % repr(self.expressions),
Show more
<https://github.com/django/django|django/django>django/django | Added by GitHub

https://jira.mongodb.org/browse/PYTHON-4834

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions