MongoEngine slicing queryset (mongodb with django)

我的未来我决定 提交于 2019-12-08 04:45:07

问题


I have a queryset like this in python.

notes = Note.objects[:10]

if i do len(notes) it gives me 10 which is correct. But when i pass "notes" object to template and try

{{notes|length}} 

then i get 16 (which is total count of note data). Even if i do Note.objects.limit(5) it's the same. Is this a bug in MongoEngine? or am i doing something wrong?


回答1:


This was a bug in MongoEngine. Issue about this can be found on; https://github.com/hmarr/mongoengine/issues/166



来源:https://stackoverflow.com/questions/5990026/mongoengine-slicing-queryset-mongodb-with-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!