Skip to content

INTPYTHON-348 add QuerySet.raw_aggregate() #163

@aclark4life

Description

@aclark4life

Via @timgraham

I don't think Django provides a hook that will let us override or customize the behavior of QuerySet.raw() , so I think we'll have to write a custom manager that developers could use on their models that will override Queryset.raw() (or probably it's better name it something different like raw_mql() ). The link between Manager and QuerySet is here: https://github.com/django/django/blob/438fc42ac667653488200578a47e59f6608f2b0b/django/db/models/manager.py#L176-L177
So I think we need a subclass of QuerySet with a raw_mql() method and then something like:

class MongoManager(BaseManager.from_queryset(MongoQuerySet)):
    pass

This could live in django_mongodb/manager.py

Then usage on the model would be:

class Model(models.Model):
    objects = MongoManager()

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