mongokit cursor iteration at jinja2

17 views
Skip to first unread message

Alex Lopez

unread,
Jun 10, 2014, 2:38:48 PM6/10/14
to mong...@googlegroups.com
Hi,

First of all, thanks for this great driver.

I've noticed that mongokit cursors do not behave correctly when iterating over them using jinja2 templates. All I could figure out is that cursors returned by find with no params iterate correctly, while those with params don't.

e.g.:

res = db.Collection.find() --> using no params in find, let's say 10 results
res2 = db.Collection.find({'arg1': 'val1'}) --> say it has 5 results


example.html:

{% for r1 in res %}
1
{% endfor %}
{% for r2 in res2 %}
2
{% endfor %}

>>>prints:

1111111111

Thanks in advance
Reply all
Reply to author
Forward
0 new messages