Skip to content

Calling limit() on a queryset does not actually limit results on server side call #943

@andrewbelu

Description

@andrewbelu

I am trying to limit the results of a query and feed the queryset to a Django template. When I try to perform the following:

records = Record.objects(query).limit(10)

And send it to a Django (v1.7) table template, this results in more than 10 records appearing in my table (71 to be exact).

Note that if I call records.count() after the limit(), it returns 71. len(records) returns 10 however.

I am using mongoengine 0.9 and pymongo 2.8.

Also note, if I cast records to a list it works fine, but I lose some of the pagination/queryset capabilities I would want.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions